Skip to content
Advertisement

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.

Advertisement

Answer

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
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement