kpofcochin has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use Net::FTP; use Net::SSH::Perl; my($host,$user,$pass) = ("Server2","user_name","password"); my $cmd = "whoami"; my $ssh = Net::SSH::Perl->new($host); $ssh->login($user, $pass); my($stdout, $stderr, $exit) = $ssh->cmd($cmd); my $ftp = $ssh->cmd(Net::FTP->new("Server3", Debug => 0) or die "Canno +t connect to Server3 $@"); $ssh->cmd($ftp->login("user_name",'password') or die "Cannot login ", +$ftp->message); $ssh->cmd($ftp->cwd("/home/tmp") or die "Cannot change working directo +ry ", $ftp->message); $ssh->cmd($ftp->put("file_in_server2") or die "get failed ", $ftp->mes +sage); $ssh->cmd($ftp->quit);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to ftp files from a remote server 1 to server 2?
by vinoth.ree (Monsignor) on Jun 26, 2015 at 17:53 UTC | |
|
Re: how to ftp files from a remote server 1 to server 2?
by salva (Canon) on Jun 26, 2015 at 22:00 UTC | |
by kpofcochin (Initiate) on Jun 28, 2015 at 06:44 UTC | |
|
Re: how to ftp files from a remote server 1 to server 2?
by soonix (Chancellor) on Jun 28, 2015 at 16:22 UTC | |
by kpofcochin (Initiate) on Jun 30, 2015 at 06:39 UTC |