By default, Ubuntu 18.04 Bionic Beaver installation comes with the unset root password. To set root password open up a terminal and execute the following Linux command. When prompted enter your current user password and new root password:

$ sudo passwd
[sudo] password for webnews: 
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

Enable SSH root login

By default SSH root login is disabled. Any attempt to ssh as root user will result in the following error message:

$ ssh root@
root@'s password: 
Permission denied, please try again.
root@'s password:

The next command will configure SSH server to allow root ssh login:

$ sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config

Restart the SSH server to apply changes:

$ sudo service ssh restart

SSH login as root

Your server now allows SSH login as root user. Use the password you set in the first step:

$ ssh root@
root@'s password: 
Welcome to Ubuntu Bionic Beaver (GNU/Linux 4.13.0-25-generic x86_64)

Leave a Reply

Your email address will not be published. Required fields are marked *