in How to

How to Disable Password login of SSH on linux

If you want to disable ssh password login on your remote server for extra security.

here how you can do this –

First you have to generate ssh keys on your Linux machine.

Open your terminal and type

                             ssh-keygen -t rsa

Then it ask for passphrase  its optional.

Once the key is generated push this key into the Server.

                      cat .ssh/ | ssh root@remotemachine ‘cat >> .ssh/authorized_keys’

Now you can login without pw prompt

                      ssh root@remotemachine

Now After login Disable the password login from remote server

Login to your remote server and open the SSH configuration file for editing by entering the  following command:

                     nano /etc/ssh/sshd_config
In this file, set the following settings to the following values. If these settings are already in the file, set them to “no” rather than add new lines.
                   ChallengeResponseAuthentication no
PasswordAuthentication no
UsePAM no
After doing changes save file by ctrl+o and enter and close by ctrl+x
Once the changes is done, restart the SSH daemon to apply the settings.
                 sudo systemctl restart sshd
Now you all set the extra level of security has been added .

Write a Comment