srchulo
srchulo

Reputation: 5203

Net::SFTP Hangs

I'm using Net::SFTP to transfer files. However, whenever I try to create a new object like so:

my $sftp = Net::SFTP->new('ip', user=>'user', password=>'pass');

It just hangs and does nothing. Does anyone know why this is? Am I doing something wrong? Thanks!

Update

Here is the debug output:

dev1.com: Reading configuration data /home/user/.ssh/config
dev1.com: Reading configuration data /etc/ssh_config
dev1.com: Connecting to 50.56.91.91, port 22.
dev1.com: Remote protocol version 2.0, remote software version OpenSSH_4.3
dev1.com: Net::SSH::Perl Version 1.34, protocol version 2.0.
dev1.com: No compat match: OpenSSH_4.3.
dev1.com: Connection established.
dev1.com: Sent key-exchange init (KEXINIT), wait response.
dev1.com: Algorithms, c->s: 3des-cbc hmac-sha1 none
dev1.com: Algorithms, s->c: 3des-cbc hmac-sha1 none
dev1.com: Entering Diffie-Hellman Group 1 key exchange.
dev1.com: Sent DH public key, waiting for reply. 
dev1.com: Received host key, type 'ssh-dss'.
dev1.com: Host 'ip_here' is known and matches the host key.
dev1.com: Computing shared secret key.
dev1.com: Verifying server signature.
dev1.com: Waiting for NEWKEYS message.
dev1.com: Send NEWKEYS.
dev1.com: Enabling encryption/MAC/compression.
dev1.com: Sending request for user-authentication service.
dev1.com: Service accepted: ssh-userauth. 
dev1.com: Trying empty user-authentication request.
dev1.com: Authentication methods that can continue: publickey,gssapi-with mic,password.
dev1.com: Next method to try is publickey.
dev1.com: Trying pubkey authentication with key file '/home/user/.ssh/id_rsa2'

Upvotes: 0

Views: 1416

Answers (2)

Mihai8
Mihai8

Reputation: 3147

Search if your connection data is correct. Use a simple code like that showed in Net::SFTP::Foreign .

Upvotes: 2

Borodin
Borodin

Reputation: 126752

In addition to the user and password options, set debug => 1. You will get some diagnostic output that may tell you what the problem is.

Upvotes: 2

Related Questions