Linux provides root
account as superuser or Administrator. As root
account has all privileges to manage a system this may be a threat for misuse or error of administrators. We generally use normal user accounts in daily operation and change to the superuser with su
command.
Root
root
exist all Linux systems and can not be deleted because of Linux privileges administration logic. root
user has special home directory located /root
and other users can not read write or execute in normal situation.
SuperUser Command Su
Some times we need to change superuser complete system related jobs. There are alternative and more secure way like using sudo
command which is short for of super user do . We have allready examined this sudo
command in the following tutorial.
Linux Sudo Command Tutorial with Examples To Get Root Privileges
su
command will ask for root
user password in order to become root user.
$ su
Run Single Command As Super User
We have the option to run single command as super user by using -c
option and the command. In this example we will run mkdir /etc/test
command as root user in order to complete command successfully.
$ su -c "mkdir /etc/test"

Differences with sudo
We can compare su
and sudo
commands like below.
su
will directly change to the root usersudo
will use current user with administrator or root privilegessu
will change user Linux environment to the rootsudo
will use current user environment after the command execution is completedsu
will requireroot
user passwordsudo
will require current user passwordsudo
will require the current user added tot heWHEEL
orROOT
group in the/etc/sudoers
file.