Here is the code and the output :
Code :
use Net::OpenSSH::Compat::SSH2 qw(:supplant); use Net::SSH2; $Net::OpenSSH::debug=-1; my $ip = 'xxx'; my $port = 22; my $username = 'user1'; my $password = 'user1'; my $ssh2 = Net::SSH2->new(); $ssh2->connect($ip,$port) or die $!; my $res = $ssh2->auth(username => $username, password => $password,) or die "$!",$ssh2->error +; print "result is $res\n";
Output :
> perl compatssh2.pl # ctl_path: /home/smokes/.libnet-openssh-perl/regression-192.168.2.-11 +175-417065, ctl_dir: /home/smokes/.libnet-openssh-perl/ # _is_secure_path(dir: /home/smokes/.libnet-openssh-perl, file mode: 1 +6832, file uid: 1003, euid: 1003 # _is_secure_path(dir: /home/smokes, file mode: 16877, file uid: 1003, + euid: 1003 # set_error(0 - 0) # call args: ['ssh','-o','ServerAliveInterval=30','-x2MN','-o','Number +OfPasswordPrompts=1','-o','PreferredAuthentications=keyboard-interact +ive,password','-S','/home/smokes/.libnet-openssh-perl/user1-192.168.2 +.-11175-417065','-l','user1','-p',22,'192.168.2.215','--'] # file object not yet found at /home/smokes/.libnet-openssh-perl/regre +ssion-192.168.2.-11175-417065 # file object not yet found at /home/smokes/.libnet-openssh-perl/regre +ssion-192.168.2.-11175-417065 # file object not yet found at /home/smokes/.libnet-openssh-perl/regre +ssion-192.168.2.-11175-417065 # file object not yet found at /home/smokes/.libnet-openssh-perl/regre +ssion-192.168.2.-11175-417065 # file object not yet found at /home/smokes/.libnet-openssh-perl/regre +ssion-192.168.2.-11175-417065 # file object not yet found at /home/smokes/.libnet-openssh-perl/regre +ssion-192.168.2.-11175-417065 # tracer attached, ssh pid: 11177, tracer pid: 11178 # set_error(1 - unable to establish master SSH connection: the authent +icity of the target host can't be established, the remote host public + key is probably not present on the '~/.ssh/known_hosts' file) # _kill_master: 11177 # waitpid(master: 11177) => pid: 0, rc: # waitpid(master: 11177) => pid: 0, rc: # waitpid(master: 11177) => pid: 0, rc: # waitpid(master: 11177) => pid: 0, rc: # waitpid(master: 11177) => pid: 0, rc: # waitpid(master: 11177) => pid: 0, rc: # waitpid(master: 11177) => pid: 0, rc: # waitpid(master: 11177) => pid: 0, rc: # waitpid(master: 11177) => pid: 0, rc: # waitpid(master: 11177) => pid: 0, rc: # waitpid(master: 11177) => pid: 0, rc: # waitpid(master: 11177) => pid: 0, rc: # killing master with signal TERM # waitpid(master: 11177) => pid: 0, rc: # waitpid(master: 11177) => pid: 11177, rc: Interrupted system call # DESTROY(Net::OpenSSH=HASH(0xdb75b0), pid: <undef>) Interrupted system callLIBSSH2_ERROR_SOCKET_DISCONNECTunable to establ +ish master SSH connection: the authenticity of the target host can't +be established, the remote host public key is probably not present on + the '~/.ssh/known_hosts' file at compatssh2.pl line 13.
In reply to Re^2: Net::OpenSSH::Compat::SSH2 auth_password fails
by madhurikl
in thread Net::OpenSSH::Compat::SSH2 auth_password fails
by madhurikl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |