'root' user does not exist?

11,819

Solution 1

You become root with sudo su (as an example). Or better said: you elevate your admin user to admin priviliges permanently until you exit. Example:

rinzwind@discworld:~$ sudo su
[sudo] password for rinzwind: 
root@discworld:/home/rinzwind# 

And no Ubuntu technically does not have an active root user. From the Ubuntu RootSudo wiki page:

In Linux (and Unix in general), there is a SuperUser named Root. The Windows equivalent of Root is Administrators group. The SuperUser can do anything and everything, and thus doing daily work as the SuperUser can be dangerous. You could type a command incorrectly and destroy the system. Ideally, you run as a user that has only the privileges needed for the task at hand. In some cases, this is necessarily Root, but most of the time it is a regular user.

By default, the Root account password is locked in Ubuntu. This means that you cannot login as Root directly or use the su command to become the Root user. However, since the Root account physically exists it is still possible to run programs with root-level privileges. This is where sudo comes in - it allows authorized users (normally "Administrative" users; for further information please refer to AddUsersHowto) to run certain programs as Root without having to know the root password.

This means that in the terminal you should use sudo for commands that require root privileges; simply prepend sudo to all the commands you would normally run as Root. For more extensive usage examples, please see below. Similarly, when you run GUI programs that require root privileges (e.g. the network configuration applet), use graphical sudo and you will also be prompted for a password (more below). Just remember, when sudo asks for a password, it needs YOUR USER password, and not the Root account password.

Solution 2

sudo -i

This command will let you land at the root shell.

More explanation and comparison between other solutions here

                                                     corrupted by user's 
                HOME=/root      uses root's PATH     env vars
sudo -i         Y               Y[2]                 N
sudo -s         N               Y[2]                 Y
sudo bash       N               Y[2]                 Y
sudo su         N               N[1]                 Y


[1] PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
probably set by /etc/environment
[2] PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
Share:
11,819
Ward Segers
Author by

Ward Segers

Updated on September 18, 2022

Comments

  • Ward Segers
    Ward Segers over 1 year

    When I run the su command, the terminal returns:

    user 'su' does not exist
    

    How do I add the root user? Can anyone answer this? I tried sudo adduser su, but after this, I get the same problem.

  • Rinzwind
    Rinzwind almost 11 years
    I edited in the legenda to [1] and [2] ;)
  • Rinzwind
    Rinzwind almost 11 years
    so to the person who downvoted: please explain why?
  • Izkata
    Izkata almost 11 years
    Now me, but "Ubuntu technically does not have a root user" is incorrect. Ubuntu's root user does not have a password, which is why su does not work.
  • Rinzwind
    Rinzwind almost 11 years
    It is locked so that means we do not have it unless you want to work in a non standard Ubuntu way ;) But I'll reword it :+)