通过 SSH 连接到 EC2 服务器出现错误请以 ec2-user 用户而不是 root 用户身份登录 [英] SSHing into EC2 server via gives error Please login as the ec2-user user rather than root user
问题描述
问题作为标题.这是为什么,我用过ssh命令:ssh -i mykey.pem root@xxx-xxx-xx-xx-xxx.compute-1.amazonaws.com但我得到了那个错误,在谷歌上什么也没找到.我做错了什么?
Question as title. Why is this, I have used the ssh command: ssh -i mykey.pem root@xxx-xxx-xx-xx-xxx.compute-1.amazonaws.com But i get that error, find nothing on google. What am I doing wrong?
推荐答案
您按照克劳斯的建议以 ec2-user
登录:
You log in as ec2-user
as Klaus suggested:
ssh -i key.pem ec2-user@host
... 然后你使用 sudo
来运行命令.例如,要编辑由 root 拥有并需要 root 权限的 /etc/hosts
文件:sudo nano/etc/hosts
.
... and then you use sudo
to run commands. E.g., to edit the /etc/hosts
file which is owned by root and requires root privileges: sudo nano /etc/hosts
.
或者你运行 sudo su
成为 root
用户.
Or you run sudo su
to become the root
user.
这篇关于通过 SSH 连接到 EC2 服务器出现错误请以 ec2-user 用户而不是 root 用户身份登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!