1. 首次实例化机器后,先以ec2-user登录服务器

2. 改root密码

sudo passwd root

3. 然后以root角色登录,修改配置:

# root权限修改
sudo su

cd /etc/ssh

vim /sshd_config

4. 找到PermitRootLogin,改为下方这种,PasswordAuthentication可能没有,需要新增,

   查找参数命令:  /PermitRootLogin

PermitRootLogin yes
PasswordAuthentication yes

5.  重启sshd

/sbin/service sshd restart

6.然后就可以密码登录了

Logo

码道开发者社区,聚焦华为云码道 CodeArts 代码智能体,沉淀 Agent、Skill、鸿蒙开发实战内容,供开发者查阅资料、交流技术、分享工程实践

更多推荐