简体   繁体   中英

Login into EC2 Instance as root

I am using putty to login to my ec2 instance. When i typed root it asked me to login as ec2-user.

Authenticating with public key "imported-openssh-key" Please login as the ec2-user user rather than root user.

when i did login as ec2-user and tried to run commands like

yum install httpd

it says

Loaded plugins: fastestmirror, priorities, security, update-motd You need to be root to perform this command.

I am running the instance for the first time. I tried searching through the amazon aws help section and google. Not able to find the solution.

To switch to a root shell, run the command:

su

If you want to execute a command as root without switching to a root shell, you can use:

sudo yum install httpd

当我在yum install命令前面添加sudo时,它对我yum install

sudo yum install docker

如果有人想切换回 root 用户,只需在您的用户终端中输入命令“exit”。

  • Write the below command before writing any command

sudo su

After that you will be the root user. Enjoy:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM