ssh 远程连接linux失败
Posted HenryLiuY
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ssh 远程连接linux失败相关的知识,希望对你有一定的参考价值。
1. 检查sshd服务的状态以及端口是否正常, 如下为正常状态
sudo netstat -nlp | grep :22
[email protected]:~$ netstat -nlp | grep 22
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp6 0 0 :::22 :::* LISTEN -
如果没有,则先重启ssh服务, 如果没有装ssh服务,则sudo apt-get install ssh
/etc/init.d/sshd restart
2. 检查防火墙是否开启
查看防火墙状态
[email protected]:~$ sudo ufw status
Status: active
偿试关闭防火墙
[email protected]:~$ sudo ufw disable
Firewall stopped and disabled on system startup
[email protected]:~$ sudo ufw status
Status: inactive
开启防火墙命令:
[email protected]:~$ sudo ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startup
he[email protected]:~$ sudo ufw status
Status: active
以上是关于ssh 远程连接linux失败的主要内容,如果未能解决你的问题,请参考以下文章