Disable Linux public key authentication

SSH server in most systems is by default configured to allow public-key authentication. The method will enable you to use your public and private key pair to passwordless log in to an SSH server instead of the typical username and password method.

How to enable Password Authentication?

you have to edit sshd_config file. the file path “etc>ssh>sshd_config” . so need to open it on a notepad. we use a nano note pad. if not have nano editor on your linux just runt this command. “sudo apt-get install nano”

let’s do our main task. 1st of all open the sshd_congig file. using the command bellow

sudo nano /etc/ssh/sshd_config

Lookup the variable: PermitRootLogin and PasswordAuthentication option change ‘no’ to ‘yes’

PermitRootlogin yes
PasswordAuthentication yes

Save and close the file. Run this command:

 service sshd reload

Now you will be able to SSH into your server without public keys.

Make sure your other authentication method such as password is enabled before disabling public key authentication method as you might completely lose remote access to your server. so ensure you know the linux password.

Leave a Comment

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

Scroll to Top