The root user is the most powerful entity in the Linux universe with limitless powers, for better or worse. Create a user? Got it. Annihilate a file system? Whoops, got that too.
The Origin Story
The root user is the Linux superuser. They can, quite literally, do anything. Nothing is restricted or off-limits for
root . Whether they’re a superhero or a supervillain depends on the human user who takes on the mantle of the system administrator. Mistakes made by the root user can be catastrophic, so the root account should be used exclusively for administrative purposes.
The concept of the root user was inherited from Unix, which had a root user as its administrative superuser. But where the name “root” comes from isn’t known for sure. Some people think that it came from the Multics operating system, which pre-dates Unix.
Ken Thompson and Dennis Ritchie, two of the most important architects and authors of Unix, had both previously worked on the Multics. Multics had a filesystem that started at a point called the root directory or “/”, and all other directories and subdirectories branched downward and outward from the root like an inverted tree. It’s the same sort of tree structure adopted by Unix. So, maybe Unix adopted the root user from Multics, too?
Searching through theMultics technical documentationuncovers a multitude of references to root logical volumes, root physical volumes, root cards, and the root directory. But there’s no mention of a root user account or a user called “root.”
Another theory is that in the early days of Unix, the home folder of the superuser was the root “/” of the filesystem. The superuser needed a name. The term “root user” had been used in place of an official name, but the term stuck and became the official name.
That seems more likely, but nobody seems to be able to say for sure how the root user got its name.
The sudo Command
On any operating system, it is best practice to reserve the superuser for administrative purposes only and to use a regular user account the rest of the time. In fact, most modern Linux distributions won’t let you log in as the root user.
Of course, this is Linux, so you can configure it to allow the root user to log in. But theless time you spend logged in as
root, the better. Besides protecting yourself from disasters arising from typos, if you can’t log in as
root, no one else can. Anyone gaining unauthorized access to your system will not be able to log in as
root, limiting what damage they can do.
But if logging in as
root is disabled, how do you administer your Linux computer? Well, that’s what the
sudo command is for. It doesn’t require the root user to log in. It temporarily bestows
root‘s powers on you. It’s like picking up Thor’s hammer Mjolnir and being temporarily granted Thor’s powers. But you can only pick up the hammer if you’re worthy. Likewise, it’s not just anyone who can use the
sudo command only bestows
root‘s powers on you if you’ve been found worthy and added to the sudoers list.
RELATEDHow to Control sudo Access on Linux
There’s another command similar to
sudo, you authenticate using your own password. With
su, you authenticate using the root user’s password. This is significant in two ways. Firstly, it means that you need to assign a password to the root user to use
su. By default, the root user has no password, and this helps with security. If
root doesn’t have a password, you can’t log in as
Secondly, if you do set a root password, everyone who is going to use the
su command needs to know the password. And sharing passwords is a security no-no, and for the root password, even more so. Any of the people who know the root password can tell someone else. If you need to change the root password, you need to communicate the new password to all the people who need to know it.
It’s much more secure to use the sudoers list to restrict who can use
sudo, and let each privileged person use their individual passwords to authenticate.
The “/etc/shadow” file contains the username of each account on your Linux computer, along with other pieces of information, including each account’s encrypted password, when the password was last changed, and when the password expires. Because it contains sensitive information, it can only be read by
If we try to use the
wc command to read the lines, words, and characters in the shadow file, we’ll be denied permission.
If we’re in the sudoers list and we use the same command with
sudo at the start of the line, we’ll be prompted for our password, and the command will be executed for us. If you’re the only user on your Linux computer, you’ll automatically be added to the sudoers list when the system is installed.
sudo wc /etc/shadow
Because we’re running the command as root, the
wc command is executed. Nobody denies root.
sudo command used to mean “superuser do.” It was enhanced to allow you to run a command as any user, so it was renamed “substitute user do.” The command is actually executed as though the other user ran it. If you don’t specify a username,
sudo defaults to using
root. If you wish to use a different user, use the
-u (user) option.
We can see that the commands are executed as another user by using the
sudo -u mary whoami
RELATED: How to Determine the Current User Account in Linux
Running as root without Using su
The snag with
sudo is that you have to use “sudo” at the start of every command. If you’re just typing one or two commands, that’s no big deal. If you have a longer sequence of commands to execute, it can become tiresome. It might be tiresome, but it does act as a useful safety catch for
root‘s powers, and you have to consciously take the safety off each and every time.
There’s a way to effectively “log in” as
rootthat doesn’t use
su and doesn’t require the root user to have a password.
Warning: Be careful when you’re using this method. Every command that you issue will be happily executed, no questions asked—even if it’s destructive.
sudo to run a Bash shell opens a new shell with
root as the user.
Note that the command prompt changes. The final character of the prompt is now a hash “#” instead of a dollar character “$.”
How the body of the command prompt is displayed varies from distribution to distribution. In Ubuntu, we’re informed that the user is
rootand shown the name of the computer and the current working directory. The color of the prompt is changed, too.
root, we can execute commands that would normally require the use of
To exit from the root user’s shell, hit “Ctrl+D” or type “exit” and hit “Enter.”
Less Superman, More Clark Kent
If you’re in the sudoers list, you have superpowers over your Linux system. Just remember, Superman spends more time as his mild-mannered alter-ego than he does in his red cape.
Use your regular user account as much as possible. Only change into
root when you really need to.
- › What Is umask in Linux, and How Do You Use It?
- › How to Find the PID of a Linux Process With pidof or pgrep
- › How to Review sudo Command Usage on Linux
- › How to Add a User to the sudoers File in Linux
- › How to Run Commands as Another User in Linux Scripts
- › How to Protect Your Linux Computer From Rogue USB Drives
- › What’s New in Fedora 36
- › How to Fix a Kmode Exception Not Handled Error in Windows
- Please click on the lower left corner of the icon (start button).
- Click Terminal menu item to open the terminal.
- Input the command below: % sudo su –
- Press Enter.
- Your terminal prompt will become #.
- You now have root privleges on all operations in the terminal window.
The Unix command su, stands for “substitute user,” “super user,” or “switch user,” and allows you to log in as root and do whatever you want with the system. Sudo stands for either "substitute user do" or "super user do" and it allows you to temporarily elevate your current user account to have root privileges.What does running as root mean? ›
A root user can do anything but normal user has no permissions. To run any command, they need to ask for permissions from the superuser. The easy and common way to grant administrative privileges to non-root users is, a user can use su command and temporarily become the root but users must know the root's password.Why is it called root Linux? ›
The name root may have originated because root is the only user account with permission to modify the root directory of a Unix system. This directory was originally considered to be root's home directory, but the UNIX Filesystem Hierarchy Standard now recommends that root's home be at /root.What is root in Linux example? ›
Root is the superuser account in Unix and Linux. It is a user account for administrative purposes, and typically has the highest access rights on the system. Usually, the root user account is called root . However, in Unix and Linux, any account with user id 0 is a root account, regardless of the name.What is the command for root? ›
To use a "root" terminal, type "sudo -i" at the command line.Does sudo make you root? ›
Resolution. sudo (superuser do) allows you to configure non-root users to run root level commands without being root. Access can be given by the root level administrator through configuration of the /etc/sudoers file.Why is it better to use sudo instead of root? ›
With sudo in place, users no longer had to change to the root user or log into that account to run administrative commands (such as installing software). Users could run those admin activities through sudo with the same effect as if they were run from the root user account.How to run sudo as root? ›
To use a "root" terminal, type "sudo -i" at the command line. The entire group of default graphical configuration tools in Kubuntu already uses sudo, so you will be prompted for your password if needed using kdesu, which is a graphical frontend to sudo.Why should you disable root? ›
Good security practices recommend that you disable the root login over SSH to prevent unauthorized access to your Linux-based machine by any other user. Disabling root login prevents root access over SSH to your Linux-based machine, which means that no one will have unlimited privileges.
- Rooting can go wrong and turn your phone into a useless brick. Thoroughly research how to root your phone. ...
- You will void your warranty. ...
- Your phone is more vulnerable to malware and hacking. ...
- Some rooting apps are malicious. ...
- You might lose access to high security apps.
The root account has virtually unlimited access to all programs, files, and resources on a system. The root account is the special user in the /etc/passwd file with the user ID (UID) of 0 and is commonly given the user name, root. It is not the user name that makes the root account so special, but the UID value of 0 .Is root the kernel? ›
kernel mode and root are two separate ideas that aren't really related to each other. The concept of running a process as root is a unix/linux term that means you're logged in as the administrator of the system. Any process you run, whether as root or a normal user, generally runs in both user mode and kernel mode.Whats is a root? ›
root. [ rōōt, rut ] A plant part that usually grows underground, secures the plant in place, absorbs minerals and water, and stores food manufactured by leaves and other plant parts. Roots grow in a root system.What is difference between root user and normal user in Linux? ›
The root user in GNU/Linux is the user which has administrative access to your system. Normal users do not have this access for security reasons.How do I access root? ›
In most versions of Android, that goes like this: Head to Settings, tap Security, scroll down to Unknown Sources and toggle the switch to the on position. Now you can install KingoRoot. Then run the app, tap One Click Root, and cross your fingers. If all goes well, your device should be rooted within about 60 seconds.What is root and how does it work? ›
Roots absorb water and minerals and transport them to stems. They also anchor and support a plant, and store food. A root system consists of primary and secondary roots. Each root is made of dermal, ground, and vascular tissues.How do I run a root file? ›
For the second argument, the following options are available:
- "RECREATE" : create a ROOT file, replacing it if it already exists.
- "CREATE" or "NEW" : create a ROOT file.
- "UPDATE" : updates the ROOT file.
- "READ" : opens an existing ROOT file for reading.
In most Linux distributions, the sudo package is installed by default. To use sudo, let's just type sudo and press enter. If sudo is installed, the sudo package usage details will be displayed. If it's not, a “command not found” message will be displayed.What are 5 Linux commands? ›
- ls - The most frequently used command in Linux to list directories.
- pwd - Print working directory command in Linux.
- cd - Linux command to navigate through directories.
- mkdir - Command used to create directories in Linux.
- mv - Move or rename files in Linux.
sudo , which is an acronym for superuser do or substitute user do, is a command that runs an elevated prompt without a need to change your identity. Depending on your settings in the /etc/sudoers file, you can issue single commands as root or as another user.How do I know if I have root access? ›
If you are able to use sudo to run any command (for example passwd to change the root password), you definitely have root access. A UID of 0 (zero) means "root", always.Is sudo the same as root? ›
What is Sudo? The sudo (superuser do) command is a command-line utility that allows a user to execute commands as the root or a different user. It provides an efficient way to grant certain users the appropriate permissions to use specific system commands or run scripts as the root user.How do I change my user to root? ›
- Enable root/admin access for your server.
- Connect via SSH to your server and run this command: sudo su -
- Enter your server password. You should now have root access.
Superuser privileges are given by being UID (userid) 0. grep for the user from the /etc/password file. The first numeric field after the user is the UID and the second is the GID (groupid). If the user is not UID 0, they do not have root privileges.What is root password? ›
A root password is the administrative password for your Red Hat Enterprise Linux system. You should only log in as root when needed for system maintenance. The root account does not operate within the restrictions placed on normal user accounts, so changes made as root can have implications for your entire system.What is difference between su and sudo? ›
su : allows you to run a command as root but requires to know the root password. All commands executed with su are not logged. sudo : allows you to run a command as root . Depending on the configuration, the command does not require the root password.What is the sudo command? ›
sudo allows a permitted user to execute a command as the superuser or another user, as specified by the security policy. The invoking user's real (not effective) user ID is used to determine the user name with which to query the security policy.How do I get out of root in Linux? ›
You can log out of the root account either by typing exit or by using the key combination of [Ctrl] - [D] .Why should you never run as root all the time when on the system? ›
Privilege escalation - If there is a security vulnerability that's exploited (in say, your web browser), by not running your programs as root will limit damage. If your web browser is running as root (because you logged in as root), then any security failures will have access to your entire system.
Use the -r flag to delete a directory that contains subdirectories and files. The -i option displays a prompt asking you to confirm directory removal. Type Y and press Enter to confirm. Note: rm -rf / is a dangerous Linux command that forces a recursive deletion on the root directory, rendering your system unusable.Does rooting delete data? ›
You should back up your essential files when doing anything to your Android device. Rooting will wipe data from your phone. Therefore, back up anything you want to keep to cloud storage, SD card, or your PC.Is it OK to root your device? ›
The Risks of Rooting
The security model of Android is also compromised when you have root. Some malware specifically looks for root access, which allows it to really run amok. For this reason, most Android phones are not designed to be rooted.
Answer and Explanation: It is not safe to do bank transactions through a rooted Android Device having a custom ROM. Rooted devices are vulnerable; if you use a rooted phone, it means that you can install an application from untrusted sources that may leak your data. Hence your account can be hacked.Why is a root important? ›
First, they provide the anchor needed to keep a plant in place. More importantly, roots are the lifeline of a plant, taking up air, water, and nutrients from the soil and moving them up into the leaves, where they can interact with sunlight to produce sugars, flavors, and energy for the plant.What are the 3 main functions of a root? ›
Its primary functions are anchorage of the plant, absorption of water and dissolved minerals and conduction of these to the stem, and storage of reserve foods.How do I boot into a root shell? ›
During boot, press and hold Shift (for BIOS) or ESC (for UEFI). This will bring up the Grub2 boot menu from where we can select "recovery mode" (usually the second boot entry). Choose "Resume normal boot" to proceed booting as usual.How do I sudo and become root? ›
- Run sudo <command> and type in your login password, if prompted, to run only that instance of the command as root. ...
- Run sudo -i . ...
- Use the su (substitute user) command to get a root shell. ...
- Run sudo -s .
The system automatically creates a superuser named root. The root password interface provides the ability to maintain system security by changing the default password for the root user of the Unitrends system. The default password is “unitrends1”.What is sudo command? ›
sudo allows a permitted user to execute a command as the superuser or another user, as specified by the security policy. The invoking user's real (not effective) user ID is used to determine the user name with which to query the security policy.
The boot partition (or boot volume) is the disk partition that contains the operating system folder, known as the system root or %systemroot% in Windows NT.What is a root boot? ›
boot/root. A disk which contains both the kernel and a root filesystem. In other words, it contains everything necessary to boot and run a Linux system without a hard disk. The advantage of this type of disk is that is it compact — everything required is on a single disk.Can ssh be as root? ›
By default, the SSH login as a root user is prevented for security reasons. Nevertheless, they are some cases where the SSH login as the root user is necessary to perform commands that are reserved for the root user under a secure SSH connection. To log in as a root user, the root user password must be set.Can root switch to any user? ›
By default, only the root user can switch to another user account without entering a password.