Amazon EC2 Root login
Solution 1
Refer to the following to set root login:
sudo -s (to become root)
vi /root/.ssh/authorized_keys
Delete the lines at the begining of the file until you get to the words ssh-rsa
.
vi /etc/ssh/sshd_config
Set the variable PermitRootLogin
to PermitRootLogin without-password
(without quotes)
sudo /etc/init.d/sshd restart
Solution 2
Try this when you authenticate with your key:
$user@instance: sudo su
or assign a password with:
$user@instance: sudo su passwd
and change the password to enter with sudo su
.
Solution 3
edit /etc/ssh/sshd_config
- Comment out the line "PermitRootLogin"
- Comment out the line "PasswordAuthentication no"
Then restart the ssh service
/sbin/service sshd restart
Solution 4
You need to edit file : /etc/ssh/sshd_config and restart ssh service .
If you want to login using keys change as below :
PermitRootLogin yes RSAAuthentication yes
If you want to login using password , change as below :
PermitRootLogin yes PasswordAuthentication yes
Solution 5
ssh into EC2 as a normal user
-
sudo su
-
cd ~
Edit the authorized_keys
vim .ssh/authorized_keys
remove the part which is not the key make sure the file will start with
ssh-rsa ............................
Save the file and try to login as a root
ssh root@servername
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Admin
Updated on July 09, 2022Comments
-
Admin almost 2 years
I'm trying to enable root login for my EC2 instances. I know I could use
su
orsudo
, but I need to be able to ssh'ing into my server as root because the Jenkins EC2-Plugin requires root access.I already found some solutions during my web search but they all didn't work:
-
PermitRootLogin
in/etc/ssh/sshd_config
- Copy
authorized_keys
to root's.ssh
-Folder
This link seemed to be quite useful but also didn't work: http://teknika.tumblr.com/post/5416465911/jenkins-ec2
-