Re: [Ssh-sftp-perl-users] ssh authentication / cipher / ? can't log in
Brought to you by:
dbrobins
From: Eric L. <net...@er...> - 2006-07-06 04:47:32
|
> -----Original Message----- > From: ssh...@li... > [mailto:ssh...@li...] On > Behalf Of Iain Buchanan > Sent: Wednesday, July 05, 2006 7:55 PM > To: ssh...@li... > Subject: [Ssh-sftp-perl-users] ssh authentication / cipher / > ? can't log in > > Hi all, > > sorry for the cryptic subject, but I've been chasing this for > a few days and I can't figure out what's going on. I'm using > Net-SSH-Perl-1.30.tar.gz > > Basically I'm getting a "permission denied" when I log in with > ssh->login. I know about eval, that's not the issue. > > > Heres the script: > > #!/usr/bin/perl -w > > use strict; > > use Net::SSH::Perl; > > my $ssh = Net::SSH::Perl->new('172.16.0.52', debug=>1); print > "logging in\n"; eval { > $ssh->login('iain', 'abcd'); # real password replaced! > }; > if ($@) { > die "Sftp connection failed:\n $@\n"; } > > print "executing ls\n"; > my($stdout, $stderr, $exit) = $ssh->cmd('ls'); print > "stdout:\n$stdout\nstderr:\n$stderr\nexit: $exit\n"; # end of script > > > > and here's the output. I added some <*** x seconds ***> to > show you where it uses 100% cpu and for roughly how long: > > orpheus: Algorithms, s->c: 3des-cbc hmac-sha1 none > <*** 11 seconds ***> > orpheus: Computing shared secret key. > <*** 11 seconds ***> > orpheus: Verifying server signature. > <*** 13 seconds ***> > orpheus: Authentication methods that can continue: > publickey,keyboard-interactive. > orpheus: Next method to try is publickey. > Sftp connection failed: > Permission denied at ./sshtest.pl line 10 This looks to me like a case of the really slow login that is a result of a couple of missing modules. Check to ensure you have Math::BigInt and IO::Handle installed. That seems to correct at least the speed issue for most people. Not sure about the permission denied, but you should be careful using password authentication if you have special characters in your passwords. That could cause some wierdness. After you install the other two modules, if you are still having problems, you might want to try public key authentication. Here is an example script I use to test with although it uses public key auth: #/usr/bin/perl use strict; use Net::SSH::Perl; use vars qw($ssh); my @ident = ( "/home/user/.ssh/id_dsa"); my %params = ( protocol => 2, interactive => 0, identity_files => [@ident], debug => 0, options => [ "BatchMode yes", "AuthenticationSuccessMsg no", "ForwardX11 no", "ForwardAgent no" ] ); my $server = $ARGV[0]; &sshconnect($server); my ($stdout, $stderr, $exit) = $ssh->cmd("ls"); print "$stdout\n"; if (! $ssh) { print "Unable to establish ssh connection to: $server\n"; } else { print "Successfully established ssh connection to: $server\n"; } sub sshconnect { my $server = $_[0]; our $ssh = Net::SSH::Perl->new("$server", %params); $ssh->login("user"); } |