How to do keyless ssh

In this blog post you will be going to see how to do keyless ssh to EC2. By Keyless we mean we can remove key based authentication and enable password based authentication. For the very first time you need to login through .pem or .ppk key. However this process does not stick only to aws ec2, you can adopt this process to any other platform on which you do a key based login provided you have sudo access.

Lets try and see how to enable password authentication and disable key based authentication. It’s not necessary for you to to disable inorder to use it. You can keep both the authentication enabled together.

Step 1: SSH to AWS Instance

Initially you need to login to aws ec2 instance through ssh key.

ssh -i xyz.pem ec2-user@

Step 2: Open sshd configuration file

nano /etc/ssh/ssh_config

Step 3: Changes in configuration

Find the line saying PasswordAuthentication no and change this to yes make it to read as

PasswordAuthentication yes

Step 4: Set password for user

If ubuntu user then

sudo passwd ubuntu

If ec2-user then

sudo passwd ec2-user

Step 5: Restart sshd service

sudo service sshd restart

Step 6: Logout and Login again, now you can password to login.

ssh ubuntu@
Please follow and like us:

Add a Comment

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