in reply to SCP connection
With regard to getting the password into the script. This isn't secure practice. A slightly more secure practice would be to generate a pwless ssh key and use that key to connect to the server.
use Net::SCP qw(scp); my ($host, $username) = ("example.com", "eric"); $scp = Net::SCP->new( { "host"=>$hostname, "user"=>$username } ); for my $file (@files) { $scp->put($file) or warn $scp->{errstr}; }
However, if you are really intent on hard-coding the password into the server, then consider using Net::SSH2. It allows all the different types of authentication.
use Net::SSH2; my $ssh2 = Net::SSH2->new(); $ssh2->connect('example.com') or die ("SSH2 Connect Error: $!"); if ($ssh2->auth_keyboard('password')) { for my $file (@files) { scp_put($file); } }
Note: All the code is untested.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: SCP connection
by rodion (Chaplain) on Jul 24, 2006 at 20:36 UTC | |
|
Re^2: SCP connection
by mantra2006 (Hermit) on Jul 24, 2006 at 20:00 UTC | |
by Joost (Canon) on Jul 24, 2006 at 20:48 UTC | |
by mantra2006 (Hermit) on Jul 25, 2006 at 18:29 UTC | |
by Joost (Canon) on Jul 25, 2006 at 20:49 UTC |