Hi All,

i am using Perl :net:ssh module to connect remotely to server and execute the 
remote command
following is the code :

my %opt = ( 'options' => [ 'ForwardAgent yes','RSAuAuthentication 
yes','ConnectTimeout 120','ServerAliveInterval 60','ServerAliveCountMax 
20','debug 1','identity_files /home/irfanjs/.ssh/id_rsa','UserKnownHostsFile 
/home/irfanjs/.ssh/known_hosts' ] );
$opt{'identity_files'} = [ $identity ];
my $ssh = Net::SSH::Perl->new($host, %opt);
print "creating an ssh object\n";
print "loggin in \n";
$ssh->login($user);

my $cmd = "ls";
print "gonna run $user\@$host $cmd\n";
 ($stdout, $stderr, $exit) = $ssh->cmd("$cmd");
print "$stderr\n";
print "$stdout\n";

but when i run the script, it fails saying that , "permission denied " error 
manually i am able to run the "ls" command using the identity file but when i 
run the same using Perl then it fails 

can someone please suggest

regards
Irfan




      

Reply via email to