ssh: connect to host localhost port 22: Connection refused 问题

来源:互联网 发布:宿州智慧云计算产业园 编辑:程序博客网 时间:2024/05/02 01:14

http://www.xuebuyuan.com/733655.html


ssh: connect to host localhost port 22: Connection refused 问题

2012年10月11日 ⁄ 综合 ⁄ 共 388字 ⁄ 字号 小 中 大 ⁄ 评论关闭
<iframe id="iframeu1788635_0" src="http://pos.baidu.com/gcnm?rdid=1788635&amp;dc=2&amp;di=u1788635&amp;dri=0&amp;dis=0&amp;dai=2&amp;ps=236x946&amp;dcb=BAIDU_SSP_define&amp;dtm=BAIDU_DUP_SETJSONADSLOT&amp;dvi=0.0&amp;dci=-1&amp;dpt=none&amp;tsr=0&amp;tpr=1460735876301&amp;ti=ssh%3A%20connect%20to%20host%20localhost%20port%2022%3A%20Connection%20refused%20%E9%97%AE&amp;ari=1&amp;dbv=2&amp;drs=1&amp;pcs=1440x775&amp;pss=1440x256&amp;cfv=0&amp;cpl=5&amp;chi=1&amp;cce=true&amp;cec=UTF-8&amp;tlm=1460735876&amp;ltu=http%3A%2F%2Fwww.xuebuyuan.com%2F733655.html&amp;ltr=https%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DgQ6Frd4A_0-K1GPYzXxh3pdXbmai0mBYmG2OyK7hhFG4M4kdygWiGltxSar3exTu%26wd%3D%26eqid%3Da33c81bb0001beab0000000457110f7d&amp;ecd=1&amp;psr=1440x900&amp;par=1440x860&amp;pis=-1x-1&amp;ccd=24&amp;cja=false&amp;cmi=7&amp;col=zh-CN&amp;cdo=-1&amp;tcn=1460735876&amp;qn=29edfc750bd4b68d&amp;tt=1460735876170.285.1102.1105" width="336" height="280" align="center,center" vspace="0" hspace="0" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" allowtransparency="true" style="margin: 0px; padding: 0px; border-width: 0px; border-style: initial; vertical-align: bottom; background: transparent;"></iframe>

命令:ssh localhost
错误信息:ssh: connect to host localhost port 22: Connection refused
 
错误原因:
1.sshd 未安装
2.sshd 未启动

3.防火墙

4需重新启动ssh 服务

 
解决方法:
1.确定安装sshd:  

$ sudo apt-get install openssh-server  

2.启动sshd: 

$ sudo net start sshd  

3.检查防火墙设置,关闭防火墙:

$ sudo ufw disable   

检验方法:
输入命令:

$ ssh localhost  

若成功,则表示安装成功,且连接通过;

但是有的时候虽然成功了但是还是会出现Connection refused 问题。

运行 ps -e | grep ssh,查看是否有sshd进程

有时候虽然可以看到sshd 但是还是不能连接成功

这时候就要想到重新启动一下:sudo service ssh restart

然后在连接

0 0
原创粉丝点击