Loading... ## 1. 连接实例  <!--more--> ## 2. 进入root用户 ``` sudo -i ``` ## 3. 修改ssh配置文件/etc/ssh/sshd_config ``` vim /etc/ssh/sshd_config ``` 将`PermitRootLogin`和`PasswordAuthentication`都修改为`yes` ``` PermitRootLogin yes PasswordAuthentication yes ``` ## 4. 设置root密码 ``` passwd ``` ## 5. 重启ssh ubuntu: ``` /etc/init.d/ssh restart ``` centos: ``` service sshd restart ``` ## 6. PS 正常情况已经可以通过root登录了,若是还无法登录,将以下文件的`no`也修改为`yes` ``` vim /etc/ssh/sshd_config.d/60-cloudimg-settings.conf ``` 最后修改:2025 年 06 月 01 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 如果觉得我的文章对你有用,请随意赞赏