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
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.