I am new to cloud technologies, we as a team works on big data for a US client and resources are on AWS EC2 instances. Whenever our client gives us access, it gives us two types of credentials. Root access credentials and sudoer user.
When I have procure an EC2 instance using AWS console. I have ppk and pem keys with me. But still when I login with ec2-user I have sudoer permissions.
How can I get root access credentials to that EC2 machine.
Srihari
November 23, 2015, 11:23am
#2
Hi Kushal,
You can do this in 3 different ways
Login into EC2 machine using credentials (.ppk and .pem key files)
Login into EC2 machine as “Normal User”
3)Login into EC2 machine as “RootUser”
Login into EC2 machine using credentials (.ppk and .pem key files)
To Enable login into EC2 machine as “Normal User”
Login into EC2 machine using credentials(ppk and pem files) and perform the following steps:
Add user using following command
sudo useradd username
Set password for user.
sudo passwd user
Edit /etc/ssh/sshd_config
Default will be “no” , make it yes.
Save and quit the file
Restart sshd service
sudo service sshd restart
Logout of the machine.
Lets try login into EC2 machine as normal user which you have created.
ssh username@EC2endpoint.
To enable login into EC2 machine as “RootUser”
Login as root user
Add user using following command
sudo useradd username
Set password for user.
sudo passwd user
Add created user into sudoers file.
i) cd /etc
ii) visudo
Add another line as shown below
Edit as following
Edit /etc/ssh/sshd_config
Default will be “no” , make it yes.
Save and quit the file
Restart sshd service
sudo service sshd restart
Logout of the machine.
Lets try login into EC2 machine as Root user which you have created.
ssh username@EC2endpoint.
Hi Team,
Please refer attached screenshot and let me know if I am going in wrong direction.
If I am logging using “ec2-user” I am able to login.
rootuser_access_screenshots.pdf (1.1 MB)
Got the answer
simple login with ppk as ec2-user
once login then enter following command you become root user and then you can modify the same
“sudo su -” + Press Enter