Stack Pointer
  • Home
  • About
  • Contact

Enable Ubuntu root Account

08 Feb 2009Mohamed Ibrahim

Ubuntu Linux distribution, by default, disables the root account. To run a command with root privileges, sudo has to be used before the command.

During the Ubuntu installation, you will never be asked to enter the root password. If you view the /etc/shadow file, you will notice that the encrypted password (2nd) field for root is usually marked with ‘!’, meaning that it is inactive.

1
2
3
ibrahim@anfield:~$ sudo cat /etc/shadow | grep '^root'
[sudo] password for ibrahim:
root:!:14239:0:99999:7:::

If you want to enable the root account, enter the following:

1
2
3
4
5
ibrahim@anfield:~$ sudo passwd
[sudo] password for ibrahim:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

You should now be able to login using the root account.

If you want to disable the root account, lock the root account by using the following command:

1
2
3
ibrahim@anfield:~$ sudo passwd -l root
[sudo] password for ibrahim:
Password changed.

Mohamed Ibrahim

ibrahim = { interested_in(unix, linux, android, open_source, reverse_engineering); coding(c, shell, php, python, java, javascript, nodejs, react); plays_on(xbox, ps4); linux_desktop_user(true); }

account, linux, root, ubuntu, unix

« Previous ArticleCommand Line Calendar
Next Article »One Gmail Account Multiple E-mail Addresses

Social Networks

Stack Pointer


Follow @stackpointerio

About
Contact
 Facebook
 Twitter
 RSS
Creative Commons License
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 4.0 International License.

Copyright © 2008-2025 Stack Pointer