1。使用页面登录ec2

2.切换root用户 sudo -i

3.为root用户或者其它用户配置密码 passwd user
passwd root
4.修改下面文件的配置vi /etc/ssh/sshd_config
PermitRootLogin和PasswordAuthentication 修改为yes

第五步:进入/etc/ssh/sshd_config.d目录,目录下会有一个*-settings.conf的文件
编辑这个文件,内容改为 PasswordAuthentication yes

第六步:重启ssh服务
systemctl restart ssh
第七步:验证密码登陆