使用XSHELL连接EC2虚拟机实例

sudo passwd root #输入2次密码给root用户设定密码
su -
passwd ec2-user #输入两次密码给ec2-user用户设定密码
sed -ri 's/^#?(PasswordAuthentication)\s+(yes|no)/\1 yes/' /etc/ssh/sshd_config
sed -ri 's/^#?(PermitRootLogin)\s+(yes|no)/\1 yes/' /etc/ssh/sshd_config #修改配置文件
sed -ri 's/^/#/;s/sleep 10"\s+/&\n/' /root/.ssh/authorized_keys
重启实例
使用ubuntu或者其他非root用户连接
posted @ 2016-09-26 18:25  BIGBIGBIG  阅读(1221)  评论(0编辑  收藏  举报