Thread: [Ssh-sftp-perl-users] ssh authentication / cipher / ? can't log in
Brought to you by:
dbrobins
From: Iain B. <ia...@ne...> - 2006-07-06 01:56:11
|
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. The problem is: I can't log in even with the correct username / password. The CPU usage seems to hit 100% for a while, and eventually fails after the debug message "Next method to try is publickey." I checked the logs for the machine I'm ssh-ing to, and there are no "failed log-in attempts" messages. Just to make sure, I logged in by hand (command line) and saw the messages in the log. I've searched all over google and the mailing list, but I still can't find out why it's not working in my case. 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: $ ./sshtest.pl orpheus: Reading configuration data /home/iain/.ssh/config orpheus: Reading configuration data /etc/ssh_config orpheus: Connecting to 172.16.0.52, port 22. orpheus: Remote version string: SSH-2.0-OpenSSH_4.3 orpheus: Remote protocol version 2.0, remote software version OpenSSH_4.3 orpheus: Net::SSH::Perl Version 1.30, protocol version 2.0. orpheus: No compat match: OpenSSH_4.3. orpheus: Connection established. logging in orpheus: Sent key-exchange init (KEXINIT), wait response. orpheus: Algorithms, c->s: 3des-cbc hmac-sha1 none orpheus: Algorithms, s->c: 3des-cbc hmac-sha1 none <*** 11 seconds ***> orpheus: Entering Diffie-Hellman Group 1 key exchange. orpheus: Sent DH public key, waiting for reply. orpheus: Received host key, type 'ssh-dss'. orpheus: Host '172.16.0.52' is known and matches the host key. orpheus: Computing shared secret key. <*** 11 seconds ***> orpheus: Verifying server signature. <*** 13 seconds ***> orpheus: Waiting for NEWKEYS message. orpheus: Enabling incoming encryption/MAC/compression. orpheus: Send NEWKEYS, enable outgoing encryption/MAC/compression. orpheus: Sending request for user-authentication service. orpheus: Service accepted: ssh-userauth. orpheus: Trying empty user-authentication request. 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 And lastly, when I log in with ssh by hand, it is almost "instantaneous". I would appreciate any tips to point me in the right direction - I tried specifying different ciphers, different authentication methods, etc, but the server logs don't even show an ssh failed or succeeded... The ip address is definitely correct. TIA, -- Iain Buchanan <iaindb at netspace dot net dot au> QOTD: "She's about as smart as bait." |
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"); } |