Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What does linux sudo mean?

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

In this article, the editor introduces "what linux sudo refers to" in detail, the content is detailed, the steps are clear, and the details are handled properly. I hope this article "what linux sudo refers to" can help you solve your doubts.

In linux, the full name of sudo is "super user do", which means "do what superusers can do". It is a system rights management command that allows non-root users to run commands that only root has permission to execute. Syntax "sudo [options] [- u new user account] commands to be executed."

The operating environment of this tutorial: Ubuntu 18.04 system, Dell G3 computer.

What does linux sudo mean?

The full name of Sudo is super user do. As the name suggests: do what superusers can do.

The Sudo command allows you to switch to another user's identity to execute the command. (the su command is also available)

Instead of using the su command to switch the user's password, the sudo command only needs to know its own password, and even we can manually modify the sudo configuration file to make it run without any password.

By default, only root users can run the sudo command, and its basic format is:

Sudo [options] [- u new user account] commands to be executed

Commonly used options and parameters:

-b: put subsequent commands in the background and let the system run on its own, without affecting the current shell environment.

-u: you can receive the user name you want to switch later. If you don't have this option, you can switch to root.

-l: this option is used as sudo-l to show which commands the current user can execute with sudo.

SUDO action

Sudo is the linux system rights management, is a tool that allows the system administrator to let ordinary users execute some or all of the root commands, such as halt,reboot,su and so on. In other words, this command allows non-root users to run commands that only root has permission to execute.

This not only reduces the login and administration time for root users, but also improves security.

SUDO principle

Can every newly created user use sudo to elevate the permissions of the command? If not, which users can use this command?

To enable a user to have the ability to use sudo, you need to have the root user register his name, specific commands that can be executed, and the identity of the user or user group into the / etc/sudoers file, that is, to complete the authorization of the user (at this time the user is called "sudoer").

When an ordinary user executes special permissions, add sudo before the command, and the system will ask you to enter your password to confirm that you are operating in front of the terminal. After confirmation, the system will run the process of the command with the authority of the superuser.

Within a certain period of time, the password is no longer asked when you execute the sudo command again, and you need to enter the password again after this time period (usually 5 minutes).

Specific use

It is assumed that the company's services use the Ubuntu 18.04operating system.

When intern girl Niu Cuihua checked in for an internship at the "Virgin Fruit Technology" company, group leader Wang Ergu needed to create an account for her that could use sudo commands. What should I do?

Step 1: Ergou first logs in to the root account and creates an account using the following command: cuiHuaNiu.

Adduser cuiHuaNiu

During the creation process, you need to specify the password of the cuiHuaNiu account, as well as other personal information, such as the phone number, etc. Ergou can also take the opportunity to get to the girl's phone.

Step 2: grant cuiHuaNiu administrator privileges, that is, register it in the / etc/sudoers file

By default, there is a sudo group on Ubuntu 18.04, and users who belong to this group can use the sudo command, so the two dogs only need to add cuiHuaNiu to the sudo group.

Usermod-aG sudo cuiHuaNiu

The-a parameter indicates attachment and is used only with the-G parameter to add users to the group.

Step 3: Niu Cuihua can log in to the server using cuiHuaNiu, and then use sudo to execute commands that can only be executed by the manager. Of course, if Cuihua has root permission, you can also use sudo-I to switch user identity to root.

Ssh cuiHuaNiu@sng.com

advantage

Sudo can restrict users from running certain commands only on a host.

Sudo provides a rich log of what each user does in detail. It can send logs to the central host or log server.

Sudo uses a timestamp file to perform a similar "ticket check" system. When the user calls sudo and enters its password, the user gets a ticket with a lifetime of 5 minutes (this value can be changed at compile time).

The configuration file for sudo is the sudoers file, which allows system administrators to centrally manage the user's permissions and hosts.

After reading this, the article "what does linux sudo mean" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it yourself to understand it. If you want to know more about related articles, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report