How-to Tutorials

How to Enable SSH Password Authentication

Proceed with caution! Using ssh password authentication in place of public key authentication is less secure and could lead to a security breach. Be especially cautious when enabling ssh password authentication for the root user.

Set PasswordAuthentication config

Some cloud providers disable password authentication by default. If for some reason you need to enable password authentication for ssh you can do so by simply running the following command.

sudo sed -i 's/.*PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config

Or you can just add PasswordAuthentication yes to your /etc/ssh/sshd_config file via vi or nano. Make sure you remove any occurrences of PasswordAuthentication no.

Reload the ssh service config

RHEL, Centos, etc

# Sysvinit
sudo service sshd reload

# Systemd
sudo systemctl reload sshd

Ubuntu, Debian, etc

# Sysvinit
sudo service ssh reload

# Systemd
sudo systemctl reload ssh

Set a password for your user

If you haven't already, make sure your ssh user has a password configured. Run the following to configure a password. Choose something good! 🙂

sudo passwd exampleusername
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully


Once again, make sure to always follow best security practices when configuring access to your servers. When possible, use a firewall to limit ssh access to your server only from trusted IP addresses.

Next Post

Previous Post

© 2023 linux bucket

All rights reserved