我正在使用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'
我想它是试图连接和请求失聪。也许是防火墙问题? – ikegami 2013-02-25 00:19:06
@ikegami,但事情是我可以在命令行中使用ssh。所以我会认为这可能不是防火墙问题。 – srchulo 2013-02-25 00:22:52
它似乎忽略了您的密码并改为使用公钥。从命令行连接时,你提供密码吗? '/ home/user/.ssh'中的内容是否正确? – Borodin 2013-02-25 01:14:33