in reply to Re^2: Can't get $ssh2->check_hostkey to work
in thread Can't get $ssh2->check_hostkey to work

I've switched over to Net::SSH::Perl to see if that is any better. I turned on its debugging machinery
{...} Bernie-7-PC: Host 'shell02.theworld.com' is known and matches the host + key. Bernie-7-PC: Verifying server signature. Bernie-7-PC: Send NEWKEYS. Bernie-7-PC: Waiting for NEWKEYS message. Bernie-7-PC: Enabling encryption/MAC/compression. Bernie-7-PC: Sending request for user-authentication service. Bernie-7-PC: Service accepted: ssh-userauth. Bernie-7-PC: Trying empty user-authentication request. Bernie-7-PC: Authentication methods that can continue: publickey,keybo +ard-inter ctive. Bernie-7-PC: Next method to try is publickey. Permission denied at D:\Desktop\sshtest.pl line 15.
It appears that the server won't accept a "password"! I don't exactly know why it says "empty authentication" and doesn't seem to try sending my password. The code is simple
my $ssh = Net::SSH::Perl->new("shell02.theworld.com", protocol => 2, debug=>1, strict_host_key_checking => "no", options => ["PasswordAuthentication yes +"] ) ; $ssh->login($login{user}, $login{password}) ;
I'll have to read up on what happens with the SSH "user-authentication service" and try to understand what's happening there. I can see why everyone who has been successful with SSH has reverted to using publickey auth..:o)

Replies are listed 'Best First'.
Re^4: Can't get $ssh2->check_hostkey to work
by zentara (Cardinal) on Aug 10, 2018 at 09:51 UTC
    Hi, you should check the settings on the SSH host you are trying to connect to. Usually its in /etc/ssh. For security reasons, many ssh servers disable root login, and many disable password logins, to force you to use keys. Read your ISP's HELP on ssh connections, or if you are in full control of the server, check out the settings in your ssh config files for the login types allowed. Your error message "Can't get $ssh2->check_hostkey to work" may be due to the fact that you don't have your keys setup properly. See setting up host keys

    I'm not really a human, but I play one on earth. ..... an animated JAPH
Re^4: Can't get $ssh2->check_hostkey to work
by salva (Canon) on Aug 11, 2018 at 23:53 UTC
    The SSH protocol provides two authentication methods, password and keyboard-interactive, accepting a user/password pair. They look the same to the user but under the hood are quite different and not interchangeable.

    In your particular case, the server is accepting k-i,and you are trying to authenticate using password authentication.

      salva, I'm not BernieC, but when answering in another thread, I saw something, in this simplified SSCCE:

      #!/usr/bin/env perl # abbreviated version of https://perlmonks.org/?node_id=1220377 use warnings; use strict; use Net::SSH2 ':all'; use Config; print STDERR "\n__DATA__\n\n"; print STDERR "\$] => $]\n"; print STDERR "$_ => $Config{$_}\n" for qw/archname osname osvers/; print STDERR "\n\nshell02.theworld.com:\n"; my $ssh2 = Net::SSH2->new(); my $rv = $ssh2->connect('shell02.theworld.com') or $ssh2->die_with_err +or; $rv = $ssh2->auth_list() or $ssh2->die_with_error; + print STDERR "\tauth_list => $rv\n"; $rv = $ssh2->auth_password_interact('dummyuser') or $ssh2->die_with_er +ror; print STDERR "\tauth_password_interact +=> $rv\n"; # this wouldn't work on my strawberry perl: "Non-blocking ReadLine + is not supported on this architecture" __DATA__ $] => 5.026002 archname => MSWin32-x64-multi-thread osname => MSWin32 osvers => 10.0.16299.371 shell02.theworld.com: auth_list => publickey,keyboard-interactive dummyuser's password? Non-blocking ReadLine is not supported on this a +rchitecture at C:/usr/local/apps/berrybrew/perls/5.26.2_64_PDL/perl/v +endor/lib/Net/SSH2.pm line 314.

      Do you know of a way to get auth_password_interact() to work with Strawberry Perl's version of ReadLine?