在介绍手机远程登录前,先教大家怎么设置登录方式由秘钥登录设置为密码登录(虽然秘钥登录的方式更加安全,但是用密码登录会更加方便)。
1、先用xshell或者Git bash用秘钥登录ip
这里用的是xshell,选择本地的秘钥文件登录
2、在用密钥登陆ec2后,为root用户创建密码:
sudo passwd root
系统会让你输入两次密码,一定要记住了!!!
3、切换为root用户,并且编辑sshd_config文件,PasswordAuthentication no,把no改成yes。使系统允许密码登陆:
su root
vim /etc/ssh/sshd_config
4、重启ssh服务
/etc/init.d/sshd restart
sshd位置因系统而异
5、为原来的用户添加密码,我原来的用户名是ec2-user
passwd ec2-user