I'm trying to enable root login for my EC2 instances. I know I could use su
or sudo
, 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
authorized_keys
to root's .ssh
-FolderThis link seemed to be quite useful but also didn't work: http://teknika.tumblr.com/post/5416465911/jenkins-ec2
You can enable password and root login using the following procedure: Update the cloud-init configuration file to allow root access and password login. Update the authorized_keys file. Update the sshd_config file to enable password authentication and root login.
AWS doesn't grant root access by default to EC2 instances. This is an important security best practise. Users are supposed to open a ssh connection using the secure key/pair to login as ec2-user. Users are supposed to use the sudo command as ec2-user to obtain elevated privileges.
If you're a root user, open the Sign in page, select Root user, and sign in using your AWS account root user credentials. Sign in using a custom URL https://account_alias_or_id.signin.aws.amazon.com/console/. You must replace account_alias_or_id with the account alias or account ID provided by the root user.
For a RHEL AMI, the user name is ec2-user or root . For a SUSE AMI, the user name is ec2-user or root . For an Ubuntu AMI, the user name is ubuntu . For an Oracle AMI, the user name is ec2-user .
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
edit /etc/ssh/sshd_config
Then restart the ssh service
/sbin/service sshd restart
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With