On 17/02/2011 11:42, Irfan Sayed wrote: > Hi All, > > I am still facing the issue. can someone please suggest ?? > > ~irfan > > --- On Thu, 2/10/11, Irfan Sayed<irfan_sayed2...@yahoo.com> wrote: > > From: Irfan Sayed<irfan_sayed2...@yahoo.com> > Subject: permission denied for Net::SSH::Perl module > To: beginners@perl.org > Date: Thursday, February 10, 2011, 11:09 AM > > 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
It is impossible to tell what the problem might be from a code fragment such as this. I am not encouraged to trust your competence, as you claim you are 'using Perl :net:ssh module'. Since not even Perl::SSH::Net appears on CPAN I guess that you are using Net::SSH::Perl. Since you don't 'use' the module, and because none of $exit, $host, $identity, $stderr, $user are declared, I guess you have removed part of your code, in the expectation that we can guess what that part contains and assume it to be correct. As a start I would try declaring $host and $identity, and making sure that: my $ssh = Net::SSH::Perl->new($host, debug => 1, identity_files => [ $identity ] ); and see what sort of result you get from that. Then try adding the out-of-band options on at a time to see if they change anything. Rob -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/