在亚马逊云(AWS)EC2上使用用户和密码进行登录

1.先用亚马逊后台连接到服务器

2.创建root的密码

|---|--------------------|
| 1 | sudo passwd root |

  

根据提示输入new password。并进行重复验证。这个密码要记牢,这就是你以后服务器使用root用户登录的密码

3.修改配置:

接下来,切换到root身份,输入如下命令

|---|-----------|
| 1 | su root |

  

使用root身份编辑亚马逊云主机的ssh登录方式

|---|---------------------------|
| 1 | vi /etc/ssh/sshd_config |

  

|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| 1 2 3 4 5 6 7 8 | 查找:PermitRootLogin 改为:PermitRootLogin yes 查找:PasswordAuthentication no 改为:PasswordAuthentication yes 查找:UsePAM yes 改为:UsePAM no |

  

4.重新启动下sshd

|---|-----------------------------|
| 1 | sudo service sshd restart |

  

5.重启AWS VPS,使用root用户和你刚才设置的密码就可以直接登录

|---|---------------|
| 1 | sudo reboot |

  

如果你还想用原账号的话(如:ubuntu)

|-------|---------------------------|
| 1 2 3 | su root passwd ubuntu |

  

复制代码
按提示,两次输入密码。 

重启,完成

相关推荐
Qianyunzhiyun15 小时前
AWS根用户MFA怎么设置?新账号安全教程
安全·云计算·aws
2601_9557594115 小时前
AWS 账单支付失败会怎样?NiceCloud 说明影响与补救
云计算·aws
全云在线allcloudonline17 小时前
北京阿里云代理商怎么选?本地服务与企业采购判断指南
阿里云·云计算·企业上云
Geek-Chow1 天前
Connecting kubectl to a Private EKS Cluster Over an Internal Domain
kubernetes·k8s·aws
Geek-Chow1 天前
A Practical Tour of AWS Networking: VPCs, Subnets, Gateways, and More
网络·aws
AOwhisky2 天前
Linux(CentOS)系统管理入门笔记(第九期)——文件权限进阶:SUIDSGIDSticky、ACL 与 chattr
linux·运维·笔记·centos·云计算·文件权限管理
Geek-Chow3 天前
Assuming an AWS IAM Role via Federation
云计算·aws
全云在线allcloudonline3 天前
上海阿里云代理商怎么选?跨区域交付能力核验清单
阿里云·云计算·企业上云