刚开始使用亚马逊的AWS的免费套餐EC2,由于个人习惯使用centos系统,所以果断安装,但是AWS为了安全性,默认禁止用户使用root账户,导致安装配置环境各种问题。转载文章,原文链接。
1、创建root的密码,输入如下命令:
sudo passwd root
2、切换到root账号,命令如下:
su root
3、编辑亚马逊aws-ec2主机的ssh登录方式,查找PasswordAuthentication no,把no改为yes,命令如下:
vi /etc/ssh/sshd_config
4、重启sshd服务,看命令
sudo /sbin/service sshd restart
5、切换root账号
su root
6、给账户centos添加密码(其它系统的是ec2-user)
passwd centos
7、至此结束,可以用root和最开始设置的root密码登录服务器了
修改PermitRootLogin和PasswordAuthentication为yes
# Authentication:
PermitRootLogin yes //默认为no,需要开启root用户访问改为yes
# Change to no to disable tunnelled clear text passwords
PasswordAuthentication yes //默认为no,改为yes开启密码登陆
---------------------
本文来自 datadev_sh 的CSDN 博客 ,全文地址请点击:https://blog.csdn.net/datadev_sh/article/details/79593360?utm_source=copy