当我尝试通过SSH连接到服务器时,出现以下错误,
[root@oneeighty ~]# ssh -vvv -p 443 [email protected] OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connecting to xxx.xxx.xxx [IP] port 443. debug1: Connection established. debug1: permanently_set_uid: 0/0 debug1: identity file /root/.ssh/identity type -1 debug1: identity file /root/.ssh/id_rsa type -1 debug1: identity file /root/.ssh/id_dsa type -1 debug1: loaded 3 keys ssh_exchange_identification: read: Connection reset by peer
我检查了服务器和客户端上的SSHconfiguration,没有问题。
重新启动服务器上的SSH服务,然后重新启动服务器/客户端,但问题未解决。
这可能是一些事情的结果。
你可以快速尝试的几件事情如下,
sshd: ALL
也许,添加sshd: ALL
到/etc/hosts.allow
你的SSHD的HostKeys可能是腐败的。 它们存在于/ etc / ssh /目录中。 您可以删除它们并重新启动sshd,并重新生成它们。 如果出现错误,请使用以下命令
$ ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key $ ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key $ ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key $ /etc/init.d/sshd start
FWIW,我在AWS上运行Ubuntu 14.04。 这个问题已经通过他们的Java Web客户端进行了SSH修复,并且运行了sudo service apache2 start
。 我只是想让我的网站备份,但它也修复了SSH访问。 不知道为什么,但我不抱怨。
检查您尝试连接的服务器上的allowed.hosts,以及它正在运行的任何iptables规则。
debugging中的下一行应该如下所示:
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debian-3ubuntu7
您已经在StackOverflow上确认您正在使用来自外部IP地址的NATing /端口转发。 你也已经validation了你可以从本地ssh到本身。 由于本地端口443工作,那么你需要validation端口映射的作品。
尝试:
iptables -L
并检查端口443是否打开,或者将INPUT和OUTPUT设置为ACCEPT tcpdump -A -s 0 port 443
,然后尝试sshing到外部IP。 你应该看到数据到达与路由器的源地址 问题已经解决。
问题出在我们networking上的负载平衡器上。 重新启动负载平衡器后问题得到解决。
我今天面临类似的问题,突然ssh访问虚拟机被拒绝了相同的消息。 ssh -v(在客户端)和sshd -d(在服务器端)没有什么帮助。 在我的情况下,问题开始由于防火墙/ iptable设置,我做了一些演示的LAMP堆栈使用更改。
我使用system-config-firewall-tui来启用防火墙,并从那里只selecthttpd阻止除httpd之外的所有其他服务。
所以作为解决这个要么添加权限sshd通过
现在ssh工作得很好!
对我来说,我在/ etc / hosts文件中允许sshd连接。
vi /etc/hosts.allow and add sshd: ALL
首先清除openssh- *(openssh-server和openssh-client)
apt-get --purge remove openssh-*
删除/home/username/.ssh目录
rm -rf /home/username/.ssh
然后安装openssh-server和openssh-client
apt-get install openssh-server openssh-client