Thread

Posted on Mon Jan 15 21:12:22 2007 by emanuel
Net-SFTP hangs after login and authentication (SSH2 not working either)
Hi, I am working on a windows XP machine trying to communicate with a Centos 4 Linux. I am trying to contact with sftp but something is going wrong... here is the output: laptop: Reading configuration data 0/.ssh/config laptop: Reading configuration data /etc/ssh_config laptop: Connecting to ###.##.##.##, port 22. laptop: Remote version string: SSH-1.99-OpenSSH_3.9p1 laptop: Remote protocol version 1.99, remote software version OpenSSH_3.9p1 laptop: Net::SSH::Perl Version 1.30, protocol version 2.0. laptop: No compat match: OpenSSH_3.9p1. laptop: Connection established. laptop: Sent key-exchange init (KEXINIT), wait response. laptop: Algorithms, c-s: 3des-cbc hmac-sha1 none laptop: Algorithms, s-c: 3des-cbc hmac-sha1 none laptop: Entering Diffie-Hellman Group 1 key exchange. laptop: Sent DH public key, waiting for reply. laptop: Received host key, type 'ssh-dss'. laptop: Host ##.##.##.## is known and matches the host key. laptop: Computing shared secret key. laptop: Verifying server signature. laptop: Waiting for NEWKEYS message. laptop: Enabling incoming encryption/MAC/compression. laptop: Send NEWKEYS, enable outgoing encryption/MAC/compression. laptop: Sending request for user-authentication service. laptop: Service accepted: ssh-userauth. laptop: Trying empty user-authentication request. laptop: Authentication methods that can continue: publickey,gssapi-with-mic,password. laptop: Next method to try is publickey. laptop: Next method to try is password. laptop: Trying password authentication. laptop: Login completed, opening dummy shell channel. laptop: channel 0: new [client-session] laptop: Requesting channel_open for channel 0. laptop: channel 0: open confirm rwindow 0 rmax 32768 laptop: channel 1: new [client-session] laptop: Requesting channel_open for channel 1. laptop: Sending subsystem: sftp laptop: Requesting service subsystem on channel 1. laptop: channel 1: open confirm rwindow 0 rmax 32768 laptop: sftp: Sending SSH2_FXP_INIT This is where it hangs... My script is : my $sftp = Net::SFTP->new($host, "user", $user, "password", $pass, "debug", "true"); and nothing else is working afterward since it hangs. I have tryed to work with NET-SSH-PERL and while trying to make it work on SSH2 it doesnt work for me but in SSH1 it connects and executes command. the SSH script : my $ssh = Net::SSH::Perl->new($host, protocol=>"2", debug=>"true"); print "Logging in...\n"; my $rc = $ssh->login($user, $pass, "true"); print "rc=$rc\n"; print "Executing command\n"; my ($out, $err, $exit) = $ssh->cmd("ls /tmp", "\n"); the SSH output (where it hangs at the end..): laptop: Reading configuration data 0/.ssh/config laptop: Reading configuration data /etc/ssh_config laptop: Connecting to ##.##.##.##, port 22. laptop: Remote version string: SSH-1.99-OpenSSH_3.9p1 laptop: Remote protocol version 1.99, remote software version OpenSSH_3.9p1 laptop: Net::SSH::Perl Version 1.30, protocol version 2.0. laptop: No compat match: OpenSSH_3.9p1. laptop: Connection established. Logging in... laptop: Sent key-exchange init (KEXINIT), wait response. laptop: Algorithms, c-s: 3des-cbc hmac-sha1 none laptop: Algorithms, s-c: 3des-cbc hmac-sha1 none laptop: Entering Diffie-Hellman Group 1 key exchange. laptop: Sent DH public key, waiting for reply. laptop: Received host key, type 'ssh-dss'. laptop: Host ##.##.##.## is known and matches the host key. laptop: Computing shared secret key. laptop: Verifying server signature. laptop: Waiting for NEWKEYS message. laptop: Enabling incoming encryption/MAC/compression. laptop: Send NEWKEYS, enable outgoing encryption/MAC/compression. laptop: Sending request for user-authentication service. laptop: Service accepted: ssh-userauth. laptop: Trying empty user-authentication request. laptop: Authentication methods that can continue: publickey,gssapi-with-mic,password. laptop: Next method to try is publickey. laptop: Next method to try is password. laptop: Trying password authentication. laptop: Login completed, opening dummy shell channel. laptop: channel 0: new [client-session] laptop: Requesting channel_open for channel 0. rc=true Executing command laptop: channel 0: open confirm rwindow 0 rmax 32768 laptop: channel 1: new [client-session] laptop: Requesting channel_open for channel 1. laptop: Entering interactive session. laptop: Sending command: ls /tmp laptop: Requesting service exec on channel 1. laptop: channel 1: send eof laptop: channel 1: open confirm rwindow 131071 rmax 32768 obviously, no command is executed and the system is left hanging. Any suggestions?? Thanks!
Direct Responses: 4447 | 4696 | Write a response
Posted on Tue Feb 27 23:43:20 2007 by cdlvj in response to 4034
Re: Net-SFTP hangs after login and authentication (SSH2 not working either)
I have exactly the same problem. Reported this way back last year. The system is connected and logged in. It just stays at that channel 1: line.
Write a response
Posted on Wed Mar 28 00:32:53 2007 by vperl in response to 4034
Re: Net-SFTP hangs after login and authentication (SSH2 not working either)
Hello, I have the exact same problem - any help would be greatly appreciated. thanks sooooooo much
Direct Responses: 4700 | 4723 | Write a response
Posted on Thu Mar 29 07:14:15 2007 by raju in response to 4696
Re: Net-SFTP hangs after login and authentication (SSH2 not working either)

In my case manual sftp was working. But the script was dropping the connection after successfully authenticating and after sending the SSH2_FXP_INIT packet.

Solution:-

Perl sftp client uses interactive mode for running command. Refer :- http://search.cpan.org/~drolsky/Net-SFTP-0.08/eg/psftp

As the login id for sftp I used was not configured for interactive ssh connection, whenever I used to loging to server using "ssh -v server name", after authenticating it was dropping the connection.

As sftp id is not supposed to have right to execute command at remote end, The login id was disabled for interactive mode.

I asked sftp server SA to enable the interactive ssh session, the problem got resolved.

Write a response
Posted on Fri Mar 30 21:05:27 2007 by vperl in response to 4696
Re: Net-SFTP hangs after login and authentication (SSH2 not working either)
Thanks a ton! I will ask the SA on the remote end to turn enable interactive session and see if it solves the problem.
Direct Responses: 4774 | Write a response
Posted on Thu Apr 5 22:08:48 2007 by vperl in response to 4723
Re: Net-SFTP hangs after login and authentication (SSH2 not working either)
Interactive SSH did not actual help in fixing the issue. Any other ideas? Thanks
Write a response