Disable ssh Password Login
This page explains how to disable ssh password login on Linux permanently and only use ssh keys for login by setting up PasswordAuthentication no option in sshd server config. So, first, you need to set up a regular non-privileged user account. Next, configure SSH keys for login. Once you have SSH Keys configured, you need to disable password login for all users, including root. This page explains to you how to generate an ssh key and disable password authentication on the Linux or Unix-based system. For demo purposes, I am using a Ubuntu Linux here, but it should work with other Linux distros such as CentOS/RHEL/Fedora/Debian and so on.
Step 1 – Login to the remote server
Use the ssh command or client such as Putty:
ssh root@server-ip-here
Step 2 – Create a new user account
Type the following command on Linux based system to create a new user named vivek:
Set the user’s password using the passwd command:# passwd vivek
Sample outputs:
Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully