my $ssh = Net::OpenSSH->new($ip,user=>$LOGIN,password=>$PASSWD, ssh_cmd=>'/opt/openssh/bin/ssh', master_opts => [-o => "StrictHostKeyChecking=no", -o => "UserKnownHostsFile=/dev/null", -o => "NumberOfPasswordPrompts=1", -o => "KexAlgorithms=diffie-hellman-group1-sha1", -o => "HostKeyAlgorithms=ssh-dss", -o => "Ciphers=3des-cbc,blowfish-cbc", -o => "PreferredAuthentications=keyboard-interactive,password", -o => "LogLevel=DEBUG3"]); $ssh->error and die "Can't ssh to $ip: " . $t->error; print STDERR 'Trying open2pty'."\n"; my ($fh,$pid) = $ssh->open2pty({ stderr_to_stdout => 1 }); print STDERR 'opening Telnet'."\n"; my $teln = Net::Telnet->new(Fhopen => $fh, ErrMode=>'die', timeout=>30, Dump_Log => '/tmp/telnet.log', prompt => '/(.*#)/'); $teln->login($LOGIN, $PASSWD); #### debug2: peer server KEXINIT proposal debug2: KEX algorithms: diffie-hellman-group1-sha1 debug2: host key algorithms: ssh-dss debug2: ciphers ctos: 3des-cbc,blowfish-cbc,twofish-cbc debug2: ciphers stoc: 3des-cbc,blowfish-cbc,twofish-cbc debug2: MACs ctos: hmac-sha1,hmac-sha1-96,hmac-md5 debug2: MACs stoc: hmac-sha1,hmac-sha1-96,hmac-md5 #### debug3: channel 2: status: The following connections are open: #1 client-session (t3 r-1 i0/0 o0/0 fd 6/7 cc -1) #2 mux-control (t16 r-1 i3/0 o3/0 fd 9/9 cc -1) Trying open2pty opening Telnet debug1: multiplexing control connection debug2: fd 9 setting O_NONBLOCK debug3: fd 9 is O_NONBLOCK debug1: channel 2: new [mux-control] debug3: channel_post_mux_listener: new mux channel 2 fd 9 debug3: mux_master_read_cb: channel 2: hello sent debug3: mux_master_read_cb: channel 2 packet type 0x00000001 len 4 debug2: process_mux_master_hello: channel 2 slave version 4 debug3: mux_master_read_cb: channel 2 packet type 0x10000004 len 4 debug2: process_mux_alive_check: channel 2: alive check debug3: mux_master_read_cb: channel 2 packet type 0x10000002 len 69 debug2: process_mux_new_session: channel 2: request tty 1, X 0, agent 0, subsys 0, term "xterm-256color", cmd "", env 1 debug3: process_mux_new_session: got fds stdin 10, stdout 11, stderr 12 debug1: channel 3: new [client-session] debug2: process_mux_new_session: channel_new: 3 linked to control channel 2 debug2: channel 3: send open debug3: send packet: type 90 debug3: receive packet: type 91 debug2: channel 1: open confirm rwindow 12288 rmax 512 debug3: receive packet: type 1 Received disconnect from 10.10.3.6 port 22:2: Disconnect Protocol error Disconnected from 10.10.3.6 port 22 #### WARNING 02/15/2018 22:59:00 UTC/GMT ssh: no supported key exchange method (curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c) DEBUG 02/15/2018 22:59:00 UTC/GMT ssh: sent msg type 1, 48 bytes