ssh Permission denied(publickey)绑定到0.0.0.0上的端口22失败:地址已在使用中

时间:2011-07-19 22:34:54

标签: ssh vmware public-key ubuntu-11.04

我正在尝试为我的开发箱添加一个密钥公钥,这是一个运行ubuntu natty的虚拟机,我无法通过ssh连接。我尝试过rsa和dsa,以及这些命令:

exec ssh-agent bash
ssh-add ~/.ssh/id_rsa
ssh-add ~/.ssh/id_dsa
SSH_AUTH_SOCK=0

我还编辑了我的sshd_config文件,如下所示:

ListenAddress 0.0.0.0
AuthorizedKeysFile %h/.ssh/authorized_keys

我也试过重启sshd以及系统。

我认为我通过运行sudo / usr / sbin / sshd -Dd找到了错误,但我不确定如何解决它:

ebug1: sshd version OpenSSH_5.8p1 Debian-1ubuntu3
debug1: read PEM private key done: type RSA
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: private host key: #0 type 1 RSA
debug1: read PEM private key done: type DSA
debug1: Checking blacklist file /usr/share/ssh/blacklist.DSA-1024
debug1: Checking blacklist file /etc/ssh/blacklist.DSA-1024
debug1: private host key: #1 type 2 DSA
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-Dd'
Set /proc/self/oom_score_adj from 0 to -1000
debug1: Bind to port 22 on 0.0.0.0.
Bind to port 22 on 0.0.0.0 failed: Address already in use.
Cannot bind any address.

感谢您的帮助。

1 个答案:

答案 0 :(得分:2)

看起来另一个进程已经运行了绑定到端口22.找出哪个:

sudo netstat -lnp --inet

然后杀了它并再试一次。