How to enable root access using password in Amazon AWS EC2 instances

By default, password ssh access is disabled, and also root ssh access is disabled. Initially we can only login into an AWS EC2 instance using a pam key.

In this article we will see what we need to do to make possible ssh login for a normal user and for the root user in a AWS EC2 instance.

After you have created your instance and managed to login using the pam key follow the steps bellow to enable password ssh for root and other users.


For this we need to edit the /etc/sshd/ssh_config file

For root login enabling

  • you will need to uncomment the PermitRootLogin yes line.
  • comment the line PermitRootLogin forced-commands-only.

For password login

  • uncomment line PasswordAuthentication yes.
  • comment line PasswordAuthentication no.


 Next we need to restart the sshd service so the new configuration will get used.


Now your AWS EC2 instance will be accessible by user/password.


  • i don`t recommend login in using the root user, this can be dangerous and does not follow the best practices.
  • also user access using password is a quite risky.
Similar Article  How to install and configure the AWS client



I hope this was helpful and i appreciate if you would like, subscribe or share our posts. I it is just a click


No Comments
Leave a Comment

%d bloggers like this: