举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔知了社区有害的内容
×
不规范转载
×
举报说明
telnet 服务器IP 22 # 或 nc -zv 服务器IP 22
Connection refused:端口未监听 / 防火墙拦截 / 服务未启动。Connection timed out:本地 / 服务器防火墙或安全组未放行 22 端口。firewall-cmd --list-all # 查看已放行端口
firewall-cmd --add-port=22/tcp --permanent # 放行22端口
firewall-cmd --reload # 重载规则
systemctl status sshd # 查看服务状态
ss -tuln | grep 22 # 确认22端口监听
systemctl start sshd 启动,systemctl enable sshd 设置开机自启。journalctl -u sshd -f 查看启动失败日志(如配置语法错误)。/etc/ssh/sshd_config):grep -E "^PermitRootLogin|^PasswordAuthentication|^Port" /etc/ssh/sshd_config
PermitRootLogin yes(允许 root 远程登录)、PasswordAuthentication yes(启用密码认证)、Port 22(端口正确)。systemctl restart sshd。passwd -S root # 检查root账户是否锁定(显示LK为锁定)
passwd root # 重置root密码
~/.ssh/authorized_keys权限为 600、.ssh目录权限为 700,所有者为 root。sestatus # 查看SELinux状态
setenforce 0 # 临时设为宽容模式(测试用)
/etc/selinux/config中SELINUX=permissive。/etc/pam.d/sshd,注释掉限制 root 登录的行(如pam_listfile.so相关规则)。
tail -f /var/log/secure # RHEL系(NingOS常用)(0)
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
暂无评论