Website Development || Software Development || Mobile App || Web App || Web Design || Cloud Services

How to Enable Password Authentication in AWS ec2 Instances

152 Views 2 min read Published: January 20, 2025 Updated: January 20, 2025

While this tutorial provides guidance on enabling password authentication for AWS EC2 instances, it is essential to note that implementing password-based authentication is not recommended for production or any development environment where security is a critical concern. The use of password authentication introduces potential security vulnerabilities and may expose your instances to unauthorized access.

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 instances.

Step 1:

Login to AWS instances

ssh -i your-key.pem username@ip_address

Step 2:

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

sudo passwd ubuntu

Step 3:

Edit sshd_config file.

sudo nano /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@IP_Address

and, enter password to login to the server.

Tags

Related Posts