Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Linux \ Usage of sudo     - Linux operating system boot manager -GRUB (Linux)

- ORA-04031 error appears in the solution run utlrp.sql (Database)

- To read the Linux ext3 / ext4 format partitions under Windows system software (Linux)

- CentOS 6.6 install Oracle 11gR2 database (Database)

- Let OpenCV face detection score output codes (Programming)

- Setting the RedHat9 Intrusion Detection System (Linux)

- Ubuntu Slingscold (Linux)

- How to use the Docker Machine cluster deployment Swarm (Server)

- Git common skills (Linux)

- Database start listening TNS-12537, TNS-12560 error (Database)

- CMake Quick Start Tutorial (Linux)

- Implement Oracle dynamic registration of non-standard port 1521 (Database)

- Linux script to copy the folder to all folders with the same name (Linux)

- Wireshark basic introduction and learning TCP three-way handshake (Linux)

- Gentoo: startx appeared Failed to load module Problem Solving (Linux)

- PostgreSQL export data dictionary documents (Database)

- Docker study notes (Server)

- CentOS 7 Configure logging (VirtualBox) (Linux)

- RedHat yum configuration and the prompt (Linux)

- Linux system security norms (Linux)

  Usage of sudo
  Add Date : 2018-11-21      
  Because root privileges too, so can not be directly under Linux login as an administrator, or su - root to operate, then we need to use the sudo command to help us perform ordinary user does not have permission management commands.

sudo command features:

1, authorize the specified user on the specified host to run specific administrative commands;

2, a detailed record of the user log information based on the command sudo executed;

3 "ticket system": the timeliness of certification, the user will be asked to first run sudo password to verify user identity positive, after the success of the user will receive a fixed time to survive long "token"; 5 minutes

How to achieve sudo functions?

/ Etc / sudoers: authority, can only be edited by the administrator; but generally do not go directly to the editor vim, since there may be a syntax error, it is generally use a dedicated tool visudo command to edit authorization.

/ Etc / sudoers:

Note: The alias definitions: alias must use all uppercase characters

Built-in variables: ALL: All users


User_Alias NAME = item1, item2, ...



%group name


$ # GID

User_Alias (means that you can use an alias has been defined)

Example: User_Alias ADMIN = CentOS,% lx, # 500

Means that the definition ADMIN alias, users have centos, lx group, UID 500 users.

Host_Alias: which can be run on the host

Host_AliasNAME = item1, item2, ...






Example: Host_Alias ALLOWADDR =, / 16

It means that the definition ALLOWADDR aliases, there is ip, network address


Runas_AliasNAME = item1, item2, ...

The usage and User_Alias


Cmnd_AliasNAME = item1, item2, ...



Contents (all commands directory)


Example: Cmnd_Alias COMMAND = / usr / sbin / useradd, / usr / sbin / userdel, / usr / sbin

It means that the definition COMMAND aliases, has all the commands useradd, userdel, and / usr / sbin under

When you define a desirable anti-: Cmnd_AliasPASSWD = / usr / bin / passwd [0-9A-Za-z] * ,! / usr / bin / passwd root

sudo authorization:


Example: centos MYPC = (root) / usr / sbin / useradd


NOPASSWD: indicates the command after the label do not lose your password

PASSWD: indicates commands are used after the label lost password

sudo command:

-l: To view the user executable sudo command current;

-u USERNAME COMMAND: a user specified to perform the specified COMMAND;

-k: Clear "token"

-b COMMAND: COMMAND specified in the background

-e / path / to / somefile: Modify the specified file;

Example: sudo-u centos useradd user1
- Use the DBMS_SCHEDULER package to manage scheduled tasks (Database)
- sa weak passwords intrusion prevention (Linux)
- C ++ handling text input (Programming)
- Analysis of common mistakes when compiling MySQL installation (Database)
- Fatal NI connect error 12170 error in Alert Log (Database)
- Linux can modify the maximum number of open files (Linux)
- C language programming entry - macro definitions and enum (Programming)
- Bash difference in single quotes and double quotes (Programming)
- Java JDK has been able to compile without warning (Programming)
- Linux system installation Gitlab (Server)
- Deploy the project to the server from GitHub (Server)
- How to troubleshoot Windows and Ubuntu dual system time is not synchronized (Linux)
- Linux Proc File System Experiment (Linux)
- Java heap (Heap) and stack difference (Programming)
- Nginx installation configuration Zabbix (Server)
- Spacewalk remove packages install the update (Linux)
- Oracle rebuild index script (Database)
- Linux beginners to develop the seven habits (Linux)
- Linux System Getting Started Learning: complete installation on Debian or Ubuntu kernel source (Linux)
- CentOS 7.1 install NTFS-3G (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.