Sudoers file parsing of sudo Tool

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.