Linux-sudoers Setup Method

Source: Internet
Author: User

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

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.