Eddie --

You might have an easier time with SCP than SFTP.

SCP uses SSH under the covers, which in turn can use public/private
keys instead of passwords.  The pass phrase for the secret key is
processed on the *client* side, so there is no need to convey it in
the transaction.  (And there are agents and other means of handling
the pass phrase, which I omit to keep this short.)

So the equivalent operation with SCP (no scripting required) is
something like ...

        scp zvm.note userid@100.1000.100.100:/users/nyse/zvm.note

EXPECT is a terrific tool, but the burden it carries (simulating the
user at a keyboard) can lead to the idle waiting that you see.

-- R;
Rick Troth
Velocity Software
http://www.velocitysoftware.com/


On Thu, Jul 12, 2012 at 7:21 PM, Eddie Chen <ec...@nyx.com> wrote:
>   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/



-- 
-- R;
Rick Troth
Velocity Software
http://www.velocitysoftware.com/

----------------------------------------------------------------------
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/

Reply via email to