使用root用户登陆到Linux实例上

vi /etc/ssh/sshd_config

找到 PermitRootLogin yes 去掉前面的 # 注释

找到 PasswordAuthentication no 将no 改为 yes

保存退出

设置root密码

passwd 

额外提醒

用户还需要关注Selinux和firewalld的情况,如果selinux为Enforcing模式,那么公网ip/外部ip是无法通过root登录成功的,另外防火墙也是一个重点

再次重启ssh服务
service sshd restart

Logo

更多推荐