Password less authentication in Ubuntu 22.04 LTS AWS EC2 

In this video we are going to learn Password less authentication in Ubuntu 22.04 LTS AWS EC2 and connect to user without Password.

Requirements

  • AWS Account
  • Amazon EC2 Ubuntu 22.04
  • A user with the sudo privilege command
  • Atleast 2 user (to connect password less)

Step #1:Create new user in Ubuntu

Lets create new user in server

sudo adduser devopshint

now navigate the devopshint user 

su - devopshint
Password less authentication in Ubuntu 22.04 LTS AWS EC2  1
img 1

Step #2:Then give some privileged using below command

Run the below command to give privileged:

 sudo visudo 

go to inside this file and add this line

devopshint ALL=(ALL) NOPASSWD:ALL
Password less authentication in Ubuntu 22.04 LTS AWS EC2  2
img 2

Step #3:Configure ssh-config file in all nodes

We need to open this config file in both nodes and uncomment this lines

sudo nano /etc/ssh/sshd_config

Then you need to uncomment these two lines

PubkeyAuthentication yes
PasswordAuthentication yes

Now we need to restart sshd service in both nodes:

sudo systemctl restart sshd

Lets check the status:

sudo systemctl status sshd

Output:

Password less authentication in Ubuntu 22.04 LTS AWS EC2  3
img 3

Step #4:Establish connection 

 Go to devopshint user in server run the below command

Login to devopshint using below command:

su - devopshint

Run the below command to connect node:

ssh ip_address ( ec2-public-ip)

Step #5:Remove password

To remove password run the below command 

We need to generate ssh keygen 

ssh-keygen 
Password less authentication in Ubuntu 22.04 LTS AWS EC2  4
img 4

You need to inside .ssh:

cd .ssh

Now run the below command using private ip of your node:

ssh-copy-id devopshint@{ec2-public-ip} 
Password less authentication in Ubuntu 22.04 LTS AWS EC2  5
img 6

Step #6:Lets connect to user without Password | Password less authentication in Ubuntu

Now lets connect to node to the server without password using below command:

ssh devopshint@ip_address
Password less authentication in Ubuntu 22.04 LTS AWS EC2  6
img 6

Conclusion:

We have covered Password less authentication in Ubuntu 22.04 LTS AWS EC2 and connect to user without Password.

Related Articles:

How to Install Redis on Ubuntu 18.04 and 16.04 LTS

Reference:

Ubuntu official page

Shweta Mamidwar

I am Shweta Mamidwar working as a Intern in Product Company. Likes to share knowledge.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link
Powered by Social Snap