Password Authentication For AWS ec2 Instances

How to Setup Password Authentication For AWS ec2 Instances

By default, 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 ec2 instances. In this tutorial, I have added the configurations required for password authentication for ec2 instances.

Password Authentication For AWS ec2

I assume that you have an instance up and running. Follow the steps given below for the password authentication setup.

Step 1: Login to the server using ssh client of your choice using the private key. For windows machines, you can use putty for connecting to the instance. If you want the steps, you can follow this article. Connecting ec2 instance using putty.

If you are using Mac or Linux, you can use the following command to connect to the instance.

Step 2:  Open sshd_config file.

Step 3:  Find the Line containing “PasswordAuthentication” parameter and change its value from “no” to “yes

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

After the changes, save the file and exit.

[irp posts=”664″ name=”How to Setup Free SSL (https) for WordPress Website using Cloudflare”]

Step 4: Setup a password for the user using “passwd” command along with the username.  You need to enter the password twice. For example, if you want to set up a password for “ubuntu“, use the following command.

Step 5: Now, restart the “sshd” service using the following command.

Step 6: Now you can log out and log in using the password you set for the user. For example,

Hope this article helps. Let me know if the comment section if you face any errors.


The majority of the big, small and medium businesses moved their infrastructure to cloud for agility, scalability,…

Read more

Hosting a static website in amazon s3 is really simple. S3 is an object store; you can store any type of file in s3.…

Read more
apache mesos on amazon ec2

Mesos is a cluster manager for various applications like Hadoop, spark, docker etc..You can manage clusters for any…

Read more

Cloud Computing Tutorial Blog