ssh连接提示 "Connection closed by remote host"
2016-08-18 16:41
627 查看
如果原来是可以用ssh连接的, 突然连接不上通常是连接数过多导致的.
# MaxSessions 10
去掉前面的"#" 并把数字改大,最后重启sshd service sshd restart 然后重新连接即可.
who
如果想要断开某个ssh 用户 可以在命令行输入
ps aux |grep sshd
得到pid 再用命令关闭那个pid:
kill -111
以上答案是通用的
我遇到的问题是ssh经常连不上我的阿里云服务器
![](http://img.blog.csdn.net/20160818164203393?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
增大了连接数,重启了sshd,甚至重启了服务器都没有解决
后来以为阿里云有啥黑科技
![](http://img.blog.csdn.net/20160818164227894?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
截图是服务器上的日志
跟这个描述很像
https://help.aliyun.com/knowledge_detail/41473.html
大概锁定是因为 PAM 模块 pam_listfile.so 相关访问控制策略导致用户登录失败。
但是具体怎么改还是不清楚
后来又时不时好了,就没在留意
今天想远程来着,又出现了相同的问题,真是怒了,一定要解决这个问题
不是太大众的问题,不是太low的问题还是google好用
![](http://img.blog.csdn.net/20160818164309855?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
居然在知乎里找到了答案 真是醉了
这同志遇到的问题给了我提示
![](http://img.blog.csdn.net/20160818164334505?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
索性改了一下ssh的端口号
OMG 可以了
![](http://static.blog.csdn.net/xheditor/xheditor_emot/default/ohmy.gif)
![](http://static.blog.csdn.net/xheditor/xheditor_emot/default/ohmy.gif)
成功来的太突然,还木有心里准备
![](http://static.blog.csdn.net/xheditor/xheditor_emot/default/laugh.gif)
![](http://static.blog.csdn.net/xheditor/xheditor_emot/default/laugh.gif)
解决方法一. 把SSH连接数改大
修改服务器上的这个文件:/etc/ssh/sshd_config 找到这行:# MaxSessions 10
去掉前面的"#" 并把数字改大,最后重启sshd service sshd restart 然后重新连接即可.
解决方法二. 每次正常退出SSH连接
每次执行完命令后用输入"exit" 退出, 防止连接数过多.解决方法三. 重启
如果连接不上远程主机可以在空间服务商的网页控制面板中重启服务查看Linux服务器有多少个用户连接ssh的方法
命令行输入who
如果想要断开某个ssh 用户 可以在命令行输入
ps aux |grep sshd
得到pid 再用命令关闭那个pid:
kill -111
以上答案是通用的
我遇到的问题是ssh经常连不上我的阿里云服务器
增大了连接数,重启了sshd,甚至重启了服务器都没有解决
后来以为阿里云有啥黑科技
截图是服务器上的日志
跟这个描述很像
https://help.aliyun.com/knowledge_detail/41473.html
大概锁定是因为 PAM 模块 pam_listfile.so 相关访问控制策略导致用户登录失败。
但是具体怎么改还是不清楚
后来又时不时好了,就没在留意
今天想远程来着,又出现了相同的问题,真是怒了,一定要解决这个问题
不是太大众的问题,不是太low的问题还是google好用
居然在知乎里找到了答案 真是醉了
这同志遇到的问题给了我提示
索性改了一下ssh的端口号
OMG 可以了
![](http://static.blog.csdn.net/xheditor/xheditor_emot/default/ohmy.gif)
![](http://static.blog.csdn.net/xheditor/xheditor_emot/default/ohmy.gif)
成功来的太突然,还木有心里准备
![](http://static.blog.csdn.net/xheditor/xheditor_emot/default/laugh.gif)
![](http://static.blog.csdn.net/xheditor/xheditor_emot/default/laugh.gif)
相关文章推荐
- ssh连接提示 "Connection closed by remote host"
- ssh连接提示 "Connection closed by remote host"
- 连接linux ssh连接提示:Connection closed by remote host
- 使用xshell连接服务器问题:ssh_exchange_identification: Connection closed by remote host
- ssh连接其他主机时候ssh_exchange_identification: Connection closed by remote host
- SSH连接服务器报ssh_exchange_identification: Connection closed by remote host
- ssh问题:ssh_exchange_identification: Connection closed by remote host
- 【ubuntu】ssh连接ubuntu虚拟机被拒Connection closed by foreign host.
- 在Centos 6.6 中ssh出现Connection to localhost closed by remote host的问题排查
- ssh_exchange_identification: Connection closed by remote host
- ssh_exchange_identification: Connection closed by remote host
- 解决ssh连接提示Connection closed by xx
- 【Ansible】SSH Error: ssh_exchange_identification: Connection closed by remote host
- ssh_exchange_identification: Connection closed by remote host
- ssh_exchange_identification: Connection closed by remote host
- ssh_exchange_identification: Connection closed by remote host
- ssh连接报Connection closed by foreign host.
- ssh问题:ssh_exchange_identification: Connection closed by remote host...
- ssh_exchange_identification: Connection closed by remote host 问题的解决 (转)
- ssh问题:ssh_exchange_identification: Connection closed by remote host