× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Kurt,

I did this a while back and just had to do it again this week. Here are my notes.

Brian.

install "tcl" and "expect" on AS400 for SFTP, because the vendor does not support public key authentication, only userid and password. The "expect" program is able to fill in the userid and password and the "tcl" is a prerequisite.

Unfortunately, the previous UCLA public server with AIX binary files is offline. Listed below is a mirror of the old http://computer-refuge.org/classiccmp/aixpdslib/pub/

http://computer-refuge.org/classiccmp/aixpdslib/pub/tcl/RISC/5.1/exec/ for tcl.8.4.9.tar.Z

http://computer-refuge.org/classiccmp/aixpdslib/pub/expect/RISC/5.1/exec/ for expect.5.43.tar.Z

As user profile with *ALLOBJ authority...

CALL QP2TERM
cp /home/bdolinar/tcl.8.4.9.tar.Z /
cp /home/bdolinar/expect.5.43.tar.Z /
uncompress tcl.8.4.9.tar.Z
uncompress expect.5.43.tar.Z
tar -xvf tcl.8.4.9.tar
tar -xvf expect.5.43.tar
cd /usr/local/bin
ls -la
expect -v

returns > expect version 5.43.0
$ ***Note: because expect will not run without the tcl framework, it has been successfully installed, even though there is no version verify command***

Below is an expect script text file which needs to be created. Swap out the various remotesite references with your information.

this is file name remotesite.expect in the IFS directory /home/sftpxfer/remotesite/

************Beginning of data**************
#!/usr/local/bin/expect -f
proc timeStamp {} {
global tcl_version
if {$tcl_version >= 7.5} {
# "clock" command requires Tcl v7.5 or greater
# internal routine a little faster than making a system call
set stamp [clock format [clock seconds] -format %Y-%m-%d,%T]
} else {
# fall back to standard UNIX system call
set stamp [exec /bin/date +%Y-%m-%d,%T]
}
return $stamp
}
puts "[timeStamp]\n"
spawn sftp remotesiteuserid@xxxxxxxxxxxxxxxxxxxxx
expect "password:"
send "remotesitepassword\n"
expect "sftp>"
send "lcd /home/sftpxfer/remotesite\n"
expect "sftp>"
send "mput *.txt\n"
expect "sftp>"
send "quit\n"
puts "[timeStamp]\n"
exit
************End of Data********************

After the file is created, be sure to mark it as executable, using chmod u+x remotesite.expect

NOTE: Remember the the remotesitepassword must be enclosed in double quotes and must have the \n at the end to send the newline.

NOTE: if the remotesitepassword has any non-regular characters or numbers, then they have to be immediately preceeded by an escaping slash character. For example if the password is pa$$word, then use "pa\$\$word\n"

And to then kick this off using a SBMJOB...

************Beginning of data**************
SBMJOB CMD(CALL PGM(QP2SHELL)
PARM('/QOpenSys/usr/bin/sh'
'-c'
'/home/sftpxfer/remotesite/remotesite.expect > /home/sftpxfer/remotesite/remotesite.output'
))
JOB(SFTPXFER) JOBQ(QUSRNOMAX) USER(BSYFTP)
************End of Data********************

And then after the jobs finish, use edtf '/home/sftpxfer/remotesite/remotesite.output' to see what it did and how long it took.

Good Luck.
Brian Dolinar.

"Kirk Goins" wrote in message news:mailman.5404.1219293280.2545.midrange-l@xxxxxxxxxxxxxxx
At the moment I'm feel like I'm caught in the IBM never ending hampster
wheel...

I know how and have done several automated FTPs using the standard FTP
Client on the iSeries. I now need to use do the same using SFTP ( PASE
and SSH ). I don't have control target system, but it's 2004 version of
WS_FTP on a windows server. Does someone have a 'condensed' set of
instructions for doing this? I will need to pass both and ID and
Password via whatever script process there is.

I have installed PASE and 5733SC1, I can connect interactively by
calling QP2TERM and then SFTP user@xxxxxxxxx I can then run my FTP cmds.
What I need how to automate this process. The docs are leading me
everywhere but to a concise doc.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.