in reply to Starting SFTP within Net:SSH::Expect
To send things interactively, you need to wait for the response from the server to make sure that server is ready. Otherwise your command will be send before server is ready and may got ignored. Try the following code.
The "waitfor" can take any regular expression and wait for a response matching the expression. For more details check at Net::SSH::Expect#Send files back to Server A my $sftp = $ssh->exec("sftp username\@remote host"); my $pass = $ssh->exec("password"); $ssh->waitfor('ftp>', 2); # Wait 2 seconds to get 'ftp>' prompt. Check + your server's prompt for correct expression. my $mput = $ssh->send("mput *.tar");
Cheers !
--VC
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Starting SFTP within Net:SSH::Expect
by pimp1911 (Initiate) on Aug 31, 2007 at 11:00 UTC | |
by pimp1911 (Initiate) on Aug 31, 2007 at 11:16 UTC |