Certain Linux operating systems require that you first log in as an administrator and then switch to the root user.
Examples are Ubuntu and Debian.
So please connect as administrator first and then type the following command.
- su root
Then you enter your root password and are logged in as root.
If you want to log in directly as root in the future, which we advise against for security reasons, you can set this in the configuration of the SSH service.
To do this, open the file /etc/ssh/sshd_config with either nano or vim.
On the line that defines the value for “PermitRootLogin” you need to change the value from “without-password” to “yes”.
Save the file and then restart the SSH service.
Depending on the operating system, this can be done with one of the following commands.
- /etc/init.d/ssh restart
- /etc/init.d/sshd restart
- systemctl restart sshd
After that, you should be able to log in directly as root.