Linux Tutorials

Enable SSH Password Login in Linux

SSH, which stands for Secure Shell, is a highly secure method of connecting to any remote server. All cloud providers prefer to login with ssh keys because it is a secure and quick way to login without providing a password.

Linux allows us to log in using a number of secure techniques. On a desktop Linux system, we typically login with a username and password. However, we can use SSH keys to login to a remote server without providing a password.

Several cloud services require their users to utilise SSH keys to login, which some users may not desire for a variety of reasons. If your SSH server is not configured to allow passwords, the ssh command to connect to the remote server will fail with the message ‘Permission denied, please try again.’

Before we continue, we’d like to tell you about Contabo. We host LinuxAndUbuntu on Contabo VPS. Check them out if you need web hosting. Prices start at $6.99 per month for an 8GB RAM and 4 Core CPU VPS.

contabo vps

In this article, I will demonstrate how to configure remote servers to accept passwords for remote login. We can also enable root user login if your cloud provider does not allow it.

Before we begin, I’d want to remind you that using an SSH key to login is considered secure. If your cloud provider has blocked remote login via password, it significantly improves the security of your server.

sudo nano /etc/ssh/sshd_config

Press CTRL + W and search for ‘PasswordAuthentication’. To enable this setting, just remove the #.

PasswordAuthentication yes
sshd config
sshd config

You should now be able to remotely login using a password in addition to the ssh key. If your cloud provider has also disabled root login, go down to the bottom of the config file or search for ‘PermitRootLogin.’ Remove # from ‘PermitRootLogin yes’ to allow root user to login remotely.

sshd config permit root login
sshd config permit root login

Now restart SSH daemon for the changes to take effect.

sudo service sshd restart

You can now access your remote server by entering your username and password. It is suggested that the root login be disabled. For added protection, server administrators can create new non-root and less-privileged users.



Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.