Understanding the Differences Between Sudo and Su

Sudo and su are commonly used commands in Linux terminals. They both allow users to execute tasks with root privileges, but they are approached differently. In this article, we will explore the key differences between sudo and su and how they function.

What is Sudo?

Sudo is a setuid binary located in the root directory. It enables users to execute root commands on behalf of authorized users. To use sudo, users need to input their own passwords to execute system commands as a root user.

Who Can Execute Sudo?

To determine which users can use sudo, you can run the following command: $ sudo /usr/sbin/visudo. This command will open the visudo file, where you can add or remove users from the sudo access list. By default, the list includes the root user with full access.

Granting sudo access requires caution, as giving unrestricted access to inexperienced users can cause significant harm. For example, modifying the visudo file to include adam ALL=(ALL) ALL, tom ALL=(ALL) ALL, or mark ALL=(ALL) ALL allows those users to have unrestricted sudo access.

Parameters of Sudo

Sudo allows for flexible configuration, where the number of commands that can be run can be specified precisely. The syntax for configuring sudo is as follows:

User_name Machine_name=(Effective_user) command
Refer to more articles:  What Is A Good Moisturizer To Use After Efudex Treatment

The syntax includes:

  • User_name: The name of the user
  • Machine_name: The name of the server where the sudo command is valid. This is especially useful when managing multiple servers.
  • (Effective_user): The user who is allowed to execute the system commands. This column allows you to grant users the ability to run system commands.
  • Command: The command or set of commands that the user can execute.

Conclusion

In summary, sudo and su provide different ways to access root privileges in Linux. While su allows users to switch to the root user by entering the root password, sudo allows users to run commands with their own account credentials. It is crucial to configure sudo access carefully to maintain security and prevent unauthorized access.

To learn more about the differences between sudo and su and how to configure sudo in Linux, check out the following references:

Related Posts

What Is A F Boy Haircut

In case you wonder why fuckboy haircut is so popular today – there are lots of reasons for that. To begin with, no matter the length there…

What To Serve With Cabbage Steaks

What To Serve With Cabbage Steaks

These roasted cabbage steaks are meltingly tender in the middle with crisp, browned edges. They’re an easy, delicious side dish or vegetarian main!You may be interested German…

What Is Concertina Wire

What Is Concertina Wire

You may be interested What To Do In Rome In 3 Days What Is 21/50 As A Decimal What Causes Burnt Valve What Are Nitrile Gloves Made…

What Are The Exceptions To Community Property In Texas

Texas is one of nine community property states. Community property is a legal standard that holds that all property acquired by either spouse during the course of…

What Happens If Raptor Liner Gets Wet Before 72 Hours

What Happens If Raptor Liner Gets Wet Before 72 Hours

Find out everything you need to know about painting your entire 4WD vehicle with raptor liner in this 8 part blog post.You may be interested What Is…

What Is A Group Of Worms Called

What Is A Group Of Worms Called

The English language is charming … and difficult to learn. Not only does English have a large general vocabulary, there are just some weird words which nobody…