Tuesday, November 3, 2009

Howto Enable and Disable ROOT Account in Ubuntu

Enabling the root account in ubuntu is rarely necessary. Almost everything you need to do as root of an Ubuntu system can be done via sudo or gksudo. If you really need a persistent root login, the best alternative is to simulate a root login shell using the following command...
$sudo -i ( same as sudo su)

To enable the root account

$ sudo passwd root

To Disable the root account

$
sudo usermod -p '!' root

4 comments:

Luis Garcia said...

Hehh no. Correct is

sudo passwd -l root <== lock
sudo passwd -u root <== unlock

shibuvarkala said...

Both are correct

Anonymous said...

But the simple is describe by panayara
$ sudo -i then press return
$ passwd then press return

Unknown said...

"If you really need a persistent root login..."

Then you probably aren't in happy multi-user land with the machine, or some task requires all the users to be logged off.
Migrating the entire /home directory to another disk or partition without taking the machine offline, for example, requires an administrative user logged into the machine, whose home directory is outside /home, and all other users logged out, so that /home can be unmounted or removed.