How to Become SuperUser or Root with su Command In Linux?

RSS
FACEBOOK
FACEBOOK
PINTEREST
PINTEREST
LINKEDIN
INSTAGRAM

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.

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.

Run Single Command As Super User

Run Single Command As Super User

Differences with sudo

We can compare su and sudo commands like below.

  • su will directly change to the root user
  • sudo will use current user with administrator or root privileges
  • su will change user Linux environment to the root
  • sudo will use current user environment after the command execution is completed
  • su will require root user password
  • sudo will require current user password
  • sudo will require the current user added tot he WHEEL or ROOT group in the /etc/sudoers file.
LEARN MORE  "-bash: sudo: command not found" Error and Solution For Linux, Debian, CentOS

RSS
FACEBOOK
FACEBOOK
PINTEREST
PINTEREST
LINKEDIN
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Open

Enjoy this blog? Please spread the word :)