Brief introduction:
The Sudoers policy module determines a user's sudo privileges. It is the default sudo policy plugin. The policy is driven by The/etc/sudoers file or, optionally in LDAP.
Configuration file:/etc/sudoers, the default file is read-only, you want to modify it, you need to force the save, or use the following command to edit the configuration file directly.
Command: Visudo
Application Scenarios:
Authorize execution of commands for a single user (sbin the following command with absolute path authorization, plus an absolute path when executing)
echo "Servyou all= (Root)/usr/local/sbin/iftop,netstat,iptraf" >>/etc/sudoers
Authorization for the user group, do not enter the password when executing the command:
echo "%servyou all= (All) nopasswd:all" >>/etc/sudoers
Explain:
Root all= (All) all
Root represents the authorized user, here is the root user;
The first all represents all computers;
The second all represents all users;
The third all represents all commands;
The general format of the/etc/sudoers is:
User Host Run_as command
User: One or several users, in/etc/group can use a% instead of it, the name of the group object must be preceded by percent%.
Host: one or several hostnames;
Run_as: As which user runs, the common option is root and all
Command: One or several root-level commands that you want the user or group to run.
This article is from the "Cold Tea" blog, please be sure to keep this source http://miaocbin.blog.51cto.com/689091/1713214
Linux-sudoers Setup Method