Hi, i need to enable root ask for password when connecting through ssh, but when i add the line: passwd root in sshd_config file and restart the service it fails. The error message points to that line. I’ve also set PasswordAuthentication to yes, just above passwd root.

Thanks for any help.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

While you are highly encouraged to use SSH keys for authentication when connecting to a server, you can enable access via password for the root account.

You are seeing that error as that line is incorrect. That is a command to run, not a line to put in the file.

First, to permit root logins with a password, you would need to add the following to your sshd_config file:

PermitRootLogin yes
PasswordAuthentication yes

Then to actually set the password for the root account, you will need to run this command:

  • sudo passwd root

It will prompt you to enter a new password for the root user.

by Etel Sverdlov
SSH keys provide a more secure way of logging into a virtual private server with SSH than using a password alone. With SSH keys, users can log into a server without a password. This tutorial explains how to generate, use, and upload an SSH Key Pair.
Submit an Answer