CentOS 7远程连接相关问题
1、检查网络配置正确。
ip addr show
route -n
2、检查防火墙状态(关闭防火墙)。
检查防火墙状态:systemctl status firewalld
如果防火墙处于活动状态,允许SSH连接:firewall-cmd --permanent --add-service=ssh
重新加载防火墙配置:firewall-cmd --reload
3、检查SSH
检查SSH服务状态:systemctl status sshd
如果服务未运行,启动SSH服务:systemctl start sshd
设置SSH服务开机自启:systemctl enable sshd
检查/etc/ssh/sshd_config文件,确保允许远程登录。
PermitRootLogin yes 允许root用户远程登录
PasswordAuthentication yes。允许密码认证
ChallengeResponseAuthentication yes。 允许挑战相应认证。
保存配置。
sudo systemctl restart sshd。重启ssh服务
4、SELinux可能会影响SSH连接。可以通过以下方式检查SELinux状态:
getenforce
如果显示为"Enforcing",可以尝试将其设置为"Permissive"或"Disabled":
setenforce 0
浙公网安备 33010602011771号