How to Become SuperUser or Root with su Command In Linux?
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
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.
su command will ask for
root user password in order to become root user.
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
sudo commands like below.
suwill directly change to the root user
sudowill use current user with administrator or root privileges
suwill change user Linux environment to the root
sudowill use current user environment after the command execution is completed
sudowill require current user password
sudowill require the current user added tot he
ROOTgroup in the