What is the root user?

If you use sudo su - or sudo -s you will have full root privileges.

Is this root user an official user or is it from Canonical?

~$ sudo su -
[sudo] password for username: 
[email protected]:~# id
uid=0(root) gid=0(root) groups=0(root)
[email protected]:~# pwd
/root
[email protected]:~# 

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

Yes the root user is an official one.

That user comes from a long line of historical influences. It’s the conventional name of the user who has all rights or permissions. Most Unix-linke operating systems have a root user. It’s not always called "root". You may know the Administrator of Windows operating systems.

The sudo program allows one to perform some action as root, such as run a command, run a shell, or log in (in a terminal only). Using sudo allows one to access root privilege only as needed, conforming to the principle of least privilege. The sudo program also provides control over the execution environment for the commands run with it, i.e. whether root’s user configurations or your own are used when commands are run.

In Ubuntu, logging in as the root user directly is disabled by default, to make it less likely that one will cause damage to the system or create security problems by making some mistake as root.

The root user can do things that a normal user cannot for example:

  • Change the owner and permissions of files/directories, regardless of the current owner or permissions
  • Bind network ports below 1024

The root user always has the UID 0 and can be identified by this UID. It is possible to create another user called root, but not for there to be two users with the same UID, hence, there is only one root. It is compulsory to have such a user.

Short digression about sudo:

The sudo program works because it has the "suid-bit" (set user id bit). This allows any user to run the program as the owner of the program. Obviously, this is an enormous security risk, and so sudo performs strict checks to see whether the user attempting to run it has the right to use sudo at all, and which commands they are allowed to run with it. This configuration is stored in the file /etc/sudoers, which should only be edited with the visudo command (you need sudo to run visudo). During installation, one sets up a first user account in Ubuntu. This first user will automatically have the right to run any command with sudo.

If the sudo executable or /etc/sudoers have wrong permissions, sudo will refuse to run.

Solution 2

It is root.

In Ubuntu root defaults to having no password set so you have to sudo su - or sudo -s to login as root. Or if you really wanted, set a password for root and bypass the need for sudo (not adviseable)

sudo su -

Open the root users default environment, So you get the root users shell etc..

sudo -s

Will open the shell defined in the variable$SHELL or /etc/passwd for the invoking user not the root user. This method you get to keep some extra enviromental variables so you know who done the sudo etc…

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply