Enable and Disable Root Login on Ubuntu


The root account in Ubuntu is disabled by default. If you want to enable root account, you need set the password of root user.

To set the root’s password, use passwd command as shown below: 

[admin@serverhow.com ~] sudo passwd root
[sudo] password for admin: <enter_your_password>
Enter new UNIX password: <enter_root_password>
Retype new UNIX password: <confirm_root_password>
passwd: password updated successfully

To disable root account login, you need to set the root’s password to expire

[admin@serverhow.com ~] sudo passwd -l root

You can switch to root account use command:

[admin@serverhow.com ~] sudo -i

mode_edit Leave a Reply

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

account_circle
web