首先利用Xshell 5使用key密匙登陆。。。密匙登陆用户名是你选择了实例操作系统作为用户名使用
接着
设置或者更改root密码
[ubuntu@ip-172-31-34-97 ~]$ sudo passwd root
Changing password for user root.
New password:
Retype new password:

更改/etc/ssh/sshd_config 配置
sudo vim /etc/ssh/sshd_config
find PermitRootLogin change PermitRootLogin yes 去掉注释
find PasswordAuthentication change PasswordAuthentication yes
find UsePAM change UsePAM yes

重启ssh 服务
sudo /etc/init.d/ssh restart
最后切换到root用户 修改ubuntu用户的密码
su root
root@ip-172-31-23-73:/home/ubuntu# passwd ubuntu
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

这样就已经可以使用root用户ssh登陆咯。。