Net :: SFTP挂起

时间:2013-02-25 00:09:07

标签: perl sftp hang net-sftp

我正在使用Net::SFTP来传输文件。但是,每当我尝试创建一个像这样的新对象时:

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

它只是挂起而什么都不做。有人知道为什么吗?难道我做错了什么?谢谢!

更新

这是调试输出:

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'

2 个答案:

答案 0 :(得分:2)

userpassword选项外,请设置debug => 1。您将获得一些可能告诉您问题所在的诊断输出。

答案 1 :(得分:2)

搜索您的连接数据是否正确。使用Net::SFTP::Foreign 中显示的简单代码。