Configuration of sudo under CentOS

Source: Internet
Author: User
Tags aliases

1 editing and defining the commands

Visudo

2 Alias (alias)

2.1 Types of aliases

Contains the following four aliases: User_alias,runas_alias,host_alias,cmnd_alias

Note: Write case sensitivity for the above alias types

Alias:: = ' user_alias ' User_alias (': ' User_alias) * |          ' Runas_alias ' Runas_alias (': ' Runas_alias) * |          ' Host_alias ' Host_alias (': ' Host_alias) * | ' Cmnd_alias ' Cmnd_alias (': ' Cmnd_alias) *

2.2 Definition format for aliases

2.2.1 How a single alias is written

Alias_type NAME = item1, item2, ...

Note: Alias members are separated by "," numbers

2.2. More than 2 aliases are written

Alias_type NAME = item1, item2, item3:name = Item4, ITEM5

Note: separated by the ":" Number

2.2.34 kinds of writing simple style

User_alias:: = Name ' = ' User_listrunas_alias:: = ' name ' = ' Runas_listhost_alias:: = ' name ' = ' Host_listcmnd_alias:: = ' name ' = ' Cmnd_list

2.3 Aliases define valid characters for name

NAME:: = [A-z] ([a-z][0-9]_) *

2.4 Examples of common definitions

Example of a 2.4.1 command-line alias definition

Role: Define user aliases and aliases that contain commands that can be run

Example:

# # Networkingcmnd_alias NETWORKING =/sbin/route,/sbin/ifconfig,/bin/ping,/sbin/dhclient,/usr/bin/net,/sbin/ Iptables,/usr/bin/rfcomm,/usr/bin/wvdial,/sbin/iwconfig,/sbin/mii-tool

Example of the definition of a 2.4.2 user alias

Role: Define user aliases and users included in aliases

# # User Aliasesuser_alias networkadmins = jsmith, Mikem

Example of 2.4.3 host alias definition

Role: Define host aliases and hosts included in aliases

Example:

# # Host Aliaseshost_alias fileservers = FS1, FS2

Note: Servers FS1 and FS2 belong to the Fileservers group

3 Permission Definition Section

Format:

# # Next comes the main Part:which users can run what software on## which machines (the sudoers file can be shared between  multiple## systems). # # syntax:#### User machine=commands#### The COMMANDS section may has other options added to it.#### allow root-to-run any commands anywhere

In fact, this means:

User name or group host command = command that can be run

Example 1 how users are defined

JSmith fileservers= (Networkadmins)

Example 2 How to define a group

Networkadmins fileservers= (Networkadmins)

Example 3 does not use the definition of a keyword at all

Root all= (All) all


------------------------------------------------------------

See Literature:

Https://www.sudo.ws/man/1.8.17/sudoers.man.html

This article is from the "Old Tan Linux Cluster blog" blog, please be sure to keep this source http://cmdschool.blog.51cto.com/2420395/1791234

Configuration of sudo under CentOS

Related Article

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.