Friday, April 13, 2018

How can I enable root ssh access in EC2

My requirement is, I need to disable the key authentication and I need to enable root ssh access to my AWS EC2 server.

How can I do that?

Login to your EC2 server with key authentication first
vim /etc/ssh/sshd_config
Disable - PermitRootLogin forced-commands-only and update the same with PermitRootLogin yes
Disable - #PermitEmptyPasswords no and update the same with PasswordAuthentication yes

/etc/init.d/sshd restart

Give root a good password.

Try to login with SSH and given root password.

################
[root@server-01 ~]# grep 'PermitRootLogin forced-commands-only' /etc/ssh/sshd_config
PermitRootLogin forced-commands-only
[root@server-01 ~]# cat /etc/ssh/sshd_config | grep PermitEmptyPasswords
#PermitEmptyPasswords no

[root@server-01 ~]#
################
Make sure this is like this.
# EC2 uses keys for remote access
PasswordAuthentication yes

No comments:

Post a Comment