There are many sudoers configuration syntaxes. Here we only list some of the ones that I think are commonly used.
The most difficult part of sudo is the/etc/sudoers syntax. Its basic syntax is as follows:
User host = commands
This syntax tells sudo the following information: the user is identified by a user; The host on which the user logs in; commands indicates any list of commands that the root user can execute.
Instances are clearer. For example, you can execute the emerge syntax on the local system (non-SSH remote logon) by using SWIFT:
Swift localhost =/usr/bin/emerge
If you can run multiple commands:
Swift localhost =/usr/bin/emerge,/usr/bin/ebuild,/usr/sbin/emerge-webrsync
Using aliases makes user group management easier:
Host_alias hostalias = hostname1, hostname2 ,...
User_alias useralias = user1, user2 ,...
Cmnd_alias cmndalias = command1, command2 ,...
All aliases are all possible.
All localhost =/sbin/Shutdown
Timestamp:
By default, sudo requires you to provide your system logon password to verify your identity. Once the password is entered, sudo remembers it for 5 minutes. You need to concentrate the task within this time period. Otherwise, you need to repeat the password every 5 minutes.
Of course, this default behavior can be changed: You can set ults in/etc/sudoers to modify the default behavior of a user.
For example, to change the default value of 5 minutes to 0 minutes (for SWIFT users, do not remember the entered password ):
Defaults: swift timestamp_timeout = 0
Extended Password limit
By default, the sudo password is valid for 5 minutes.
If you want to extend the time, you can run Sudo-V to reset the timestamp, which starts a 5-minute password memory time. $ Sudo-V
To stop the current timestamp, use Sudo-K.
[Reference]
Gentoo sudo (ERS) Guide
Http://www.gentoo.org/doc/zh_cn/sudo-guide.xml