Re: [Ssh-sftp-perl-users] Net::SSH and publickey (was Net::SFTP and publickey)
Brought to you by:
dbrobins
From: Chris L. <cp...@fa...> - 2004-09-16 14:43:57
|
Mark Fuller wrote: > The way to use "%args" is clear as *mud* and not > in the SFTP documentation. I was wrestling with the same lack of documentation today in a Net::SSH::Perl context. I came across your message which sorted me out fast. Thanks. I took your sample for Net::SFTP, and applied it thus: use Net::SSH::Perl; my $host = 'domain.com'; my $user = 'user'; my $pass = 'pass'; # not used during key-based auth my $debug = 0; my $port = 22; my $identity = '/path/to/.ssh/id_rsa'; my @ssh_args = ( debug => $debug, identity_files => ([$identity]), port => $ssh_port, ); my $command = 'uptime'; my $ssh = Net::SSH::Perl->new($host, @args); # key-based login: $ssh->login($user); # or password-based login: # $ssh->login($user, $pass); my ($stdout, $stderr, $exit) = $ssh->cmd($command); warn ("error performing command: $command ($stderr)") if ($exit); print $stdout; exit; Regards Chris Langlands -- Fast Media http://www.fastmedia.com/ |