操作步骤:
第一步:先以ubuntu用户登陆 EC2
第二步:提权切换root用户 sudo -i
第三步:为root用户或者其它用户配置密码 passwd user
第四步:修改 /etc/ssh/sshd_config
PermitRootLogin和PasswordAuthentication 修改为yes
第五步: 进入/etc/ssh/sshd_config.d目录,目录下会有一个*-settings.conf的文件
编辑这个文件,内容改为 PasswordAuthentication yes
第六步:重启ssh服务
systemctl restart ssh
第七步:验证密码登陆
ssh root@EC2的公有IP