How to allow the root user to login using a password?

In some OSes, by default it is forbidden for the root user to log in using a password. To change this, you need to edit the configuration file of the SSH daemon through the local console.

Check the configuration files in the directory /etc/ssh/sshd_config.d/*.conf and replace PermitRootLogin no with PermitRootLogin yes and PasswordAuthentication no with PasswordAuthentication yes.

If this directory is empty, create a new file and fill it with the following data:

[wpcm lang="bash"]sudo tee /etc/ssh/sshd_config.d/60-cloudimg-settings.conf << EOF PermitRootLogin yes PasswordAuthentication yes EOF[/wpcm]

If the sshd_config.d directory does not exist, add the settings to the end of the main configuration file:

[wpcm lang="bash"]sudo echo "PermitRootLogin yes" >> /etc/ssh/sshd_config sudo echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config[/wpcm]

Then restart the SSH daemon or reboot the VM:

[wpcm lang="bash"]sudo systemctl restart ssh[/wpcm]

or (OS dependent):

[wpcm lang="bash"]sudo systemctl restart sshd[/wpcm]

Рейтинг: 1 Star2 Stars3 Stars4 Stars5 Stars (1 оцінок, сер. 5.00)
Loading...