News

What is Root in Linux?

In this article, we will look at the root account of the Linux operating system and the benefits and important points of using it.

The story of Ruth’s origin

The main user is a Linux superuser. These users can literally do anything on the operating system and nothing is restricted to them. Whether a Linux root user is a good or malicious user depends on who really has access to the operating system. If the root user does something wrong, the effect is likely to be catastrophic; Therefore, Linux root should be used specifically for office purposes only.

According to the HowToGeek website, in Linux the concept of root user is inherited from the Unix operating system. In fact, Unix had Ruth as its administrative superus; But it is not yet possible to say exactly where Ruth’s name came from.

Ken Thompson And Dennis Ritchie, Two of the leading architects and writers of the Unix operating system, had previously worked on the Multics project. Multix had a filesystem that started at a point called the root directory, or “/”, and all other folders and subdirectories branched down and out of the root with a tree-like structure. This is the same tree structure that Unix has adopted; Therefore, Unix may have accepted the original Multix user as well.

By searching Multix technical documentation, one can find many references to logical root volumes, physical root volumes, root cards, and root folders; But these documents do not mention the root account or root username.

The theory is that Superuser’s main folder in the early days of Unix was the root filesystem. The superuser needed a name to execute the commands. The term root user was used instead of the official name; But the term persisted and later became known as the official name of the Unix superuser. This is only possible, and it seems that no one can say for sure how and where the root username came from.

Sudo command

The best way is to use the superuser in any operating system only for office purposes and the regular user account for other situations ‌‌. In fact, most modern Linux distributions do not allow you to log in as the primary user. Of course, since Linux is an open source and very flexible operating system, it can be configured to allow the root user to log in.

It should be noted that the less time you spend logging in as a root user, the better. In addition to protecting yourself from problems with spelling mistakes when logging in as a root user, if you can not log in with this level of user, no one else can. This means that a user who has unauthorized access to your system will not be able to log in as a root user, thus reducing the likelihood of unauthorized users being harmed.

You may now be wondering how to manage your Linux computer if logging in as a root user is disabled. In such cases, you can use the Sudo command. You will not need to log in as a root user to take advantage of the features of this command. This command will temporarily make the powers of the root user available to you.

You can only use this command if you have the necessary prerequisites to access it. However, not all users can use the Sudo command. The above command will only give you the root if you have the prerequisite to use it and you have been added to the list of Sudoers of your Linux operating system.

The Su command is similar to the Sudo command. You must use a password to authenticate in Sudo; But to use it, you must use the original user password. This is important in two ways:

  • To use the Su command, you must assign a password to the root user. The root user does not have a password by default, and setting a password can help increase the security of the operating system. If you have not registered a password for your root user, you will not be able to log in as this user;
  • If you set the root password, all users must have access to the Su command to use this password. Sharing passwords is a security issue and is even more important for the root of a Linux user. For example, a user who has access to a root password can share that password with another person. If you want to change the root password of your Linux computer, you must send this new password to anyone who needs to know it.

Using the Sudoers list to limit the number of people who can use the Sudo command is much safer; This is because we allow anyone who needs root access to use this password for authentication.

Use the Sudo command

The “/ etc / shadow” file contains the usernames of the various accounts on your Linux computer. This file also contains other information such as the encrypted password of each user account and the last time the password was changed and when the password expired.

Because very sensitive information is stored on this file, it can only be accessed by the root user. If we want to use the wc command to read the lines, words and characters in the file, we will not get permission.

Use the sudo command

If we are in the Suduers list and use the same Sudo command at the beginning of the line, the password of the request and command will be executed for us. If you are the only user of your Linux computer, you will be automatically added to the Sudoers list after installing the system. Since we execute this command as root, the wc command will be executed and in this case no one will deny the root user.

Sudo command

The Sudo command means Superuser do. This command allows you to execute the command as you would any other user. Therefore, its name was changed to Substitute user do. This command is executed as if another user had executed it. If you do not specify a username, the Sudo command will use Root by default. If you want to use another user to execute the command, use the -u (user) option.

In the image below, the command will be executed as another user.

Use the sudo command

Execute the command as root without using Su

The problem with Sudo is that you have to use the phrase Sudo at the beginning of each command. This is not a big deal when you only want to type one or two commands; But when you need to execute a large number of commands, typing Sudo for each of these commands may be tedious. It goes without saying that this feature acts as a useful security tool for the Root user’s capabilities, and you should consciously bypass this security every time.

Related articles:

There is a way to effectively log in as a root user that you will not need to use Su and password for the root user. Note the very important point that when using this method, you must be very careful and act carefully; Because any order you issue will be executed without any restrictions; Even if the commands you are looking for are malicious to the operating system. Using Sudo to run the Bash shell will open a new shell with Root as the user.

Sudo command

Note that the command line will change in this case, and the final character of the command will now be hashed # instead of $. How the command line body is displayed in different Linux distributions is different. In Ubuntu, for example, we are notified that the user has root access, and the current computer name and work folder are displayed. In this Linux distribution, the color of the notification will also change. Since we are a root user, we can execute commands that usually require the use of Sudo.

Sudo command

To exit the main user’s skin, press Ctrl + D and type Exit, then press Enter.

Sudo command

If your username is in the Sudoers list, you have full power to make any changes and execute any commands on your Linux operating system. Just keep in mind that using the system as a root user requires great care; Because as we mentioned, any command that this user requests from the operating system will be executed without any restrictions; Even if the command is dangerous or harmful to the operating system itself.

Thus, we suggest that you try to use your regular account as much as possible and only use this access when you really need the root user capabilities.


Source link

Related Articles

Leave a Reply

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

Back to top button

Adblock Detected

Please consider supporting us by disabling your ad blocker