How to Enable Password Authentication in AWS ec2 Instances

 

Please Note this article is only for information and practice. Please don’t do this until you have any specific and valid reason. Because it’s a big security hole by opening direct root access and enable password authentication of the server in the cloud.

By default, AWS ec2 instances don’t have password authentication. You have to use the private key to connect to the instances. However, you might have situations to use password-based authentication for your AWS ec2 instances.

In this tutorial, we have done the configuration to enable password authentication in AWS instance.

Step 1:

Login to AWS instances

ssh -i your-key.pem username@ip_address

Step 2:

Setup a password for the user using passwd command along with the username.

sudo passwd ubuntu

Step 3:

 

Edit sshd_config file.

sudo vim /etc/ssh/sshd_config

Find the Line containing ‘PasswordAuthentication’ parameter and change its value from‘no’ to ‘yes’

PasswordAuthentication yes

If you want to set up ‘root’ login, find  ‘PermitRootLogin’ parameter and change its value from ‘prohibit-password’ to ‘yes’

PermitRootLogin yes


After this changes save file and exit.

Step 4:

Restart the SSH service.

service ssh restart                                  ## for ubuntu

service sshd restart                                ## for centos

Step 5:

Now we can log in using the password you set for the user. For example,

ssh ubuntu@13.21.72.66

 

AmritMatti

I’m the owner of “DevOpsTechy.online” and been in the industry for almost 5 years. What I’ve noticed particularly about the industry is that it reacts slowly to the rapidly changing world of technology. I’ve done my best to introduce new technology into the community with the hopes that more technology can be utilized to serve our customers. I’m going to educate and at times demonstrate that technology can help businesses innovate and thrive. Throwing in a little bit of fun and entertainment couldn’t hurt right?

AmritMatti

I’m the owner of “DevOpsTechy.online” and been in the industry for almost 5 years. What I’ve noticed particularly about the industry is that it reacts slowly to the rapidly changing world of technology. I’ve done my best to introduce new technology into the community with the hopes that more technology can be utilized to serve our customers. I’m going to educate and at times demonstrate that technology can help businesses innovate and thrive. Throwing in a little bit of fun and entertainment couldn’t hurt right?

View all posts by AmritMatti →

Leave a Reply

Your email address will not be published. Required fields are marked *