Hi Robert, It just so happened the sysadmin had install "lftp"on the server. I try sftp without password and it works fine.
Thanks and regards, Eddie -----Original Message----- From: Linux on 390 Port [mailto:LINUX-390@VM.MARIST.EDU] On Behalf Of Hodge, Robert L Sent: Friday, July 13, 2012 10:25 AM To: LINUX-390@VM.MARIST.EDU Subject: Re: Running SecureFTP in background mode using perl "expect" Eddie, You may want to check out the "lftp" client. Lftp will accept FTP commands via a file, including the password. -----Original Message----- From: Linux on 390 Port [mailto:LINUX-390@VM.MARIST.EDU] On Behalf Of Eddie Chen Sent: Thursday, July 12, 2012 5:22 PM To: LINUX-390@VM.MARIST.EDU Subject: EXTERNAL: Running SecureFTP in background mode using perl "expect" Hi folks, I have a perl script that issue SecureFTP(sftp) to automate the file transfer and the password prompt. When the script runs in the foreground, it works, and it takes the password. Example: [echen@startnet11 ~]$ ksh EDC.ksh Eddie.cmd userid@100.1000.100.100's password: sftp> put zvm.note zvm.note Uploading zvm.note to /users/nyse/zvm.note sftp> ls -l zvm.note -rwxr-x--- 0 0 0 667 Jul 12 19:08 zvm.note sftp> bye Note: The input file "Eddie.cmd" contains the userid and password. When I run the script in background, the password prompts comes back to my terminal and not to the script. Example: [echen@startnet11 ~]$ ksh EDC.ksh Eddie.cmd& [17] 8228 userid@100.1000.100.100's password: Also when I do the "ps" I see the script sitting idle. echen 27044 27043 0 18:08 pts/9 00:00:00 sftp -b /tmp/sftp_batch27041 use...@customer.com the question is, is there other way where I can get password working running in the background. my $expect = Expect->spawn("sftp -o 'BatchMode no' -b $BATCH $user\@$host"); $expect->expect(10,"password:"); $expect->send("$password\n"); $expect->interact; Please consider the environment before printing this email. Visit our website at http://www.nyse.com **************************************************** Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext. ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390 ---------------------------------------------------------------------- For more information on Linux on System z, visit http://wiki.linuxvm.org/ ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390 ---------------------------------------------------------------------- For more information on Linux on System z, visit http://wiki.linuxvm.org/ Please consider the environment before printing this email. Visit our website at http://www.nyse.com **************************************************** Note: The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system. Thank you. NYSE Euronext. ---------------------------------------------------------------------- For LINUX-390 subscribe / signoff / archive access instructions, send email to lists...@vm.marist.edu with the message: INFO LINUX-390 or visit http://www.marist.edu/htbin/wlvindex?LINUX-390 ---------------------------------------------------------------------- For more information on Linux on System z, visit http://wiki.linuxvm.org/