The sudo command uses

Source: Internet
Author: User

First, su and the sudo Command

1.su:switchuser, toggle command

Su-l user-c ' COMMAND '

Su-l root-c ' COMMAND '

Su-l Root

2.sudo

The authorized user runs the specified command as another user, and the default record is 5 minutes for successful authentication ;

To run the specified command in a sudo manner; sudo [-uuser][options]command

-uuser: Default is root;

- H: Get help information ;

-K: Clear the previous record user password;

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7A/2A/wKiom1akr-HzgsXBAADDRJDHXm0445.png "title=" 3.png " alt= "Wkiom1akr-hzgsxbaaddrjdhxm0445.png"/>

Second, sudo Configuration

1. configuration file:/etc/sudoers

file permissions , edit this file-specific command visudo, automatically detect syntax and related errors

Root all= (All) all

%wheel all= (All) all # Wheel Group, users who join this group can Root 's identity to run the command

Note: Define normal user in wheel Group, can su to Administrator password:# Sudosu-root

2. Configuration item syntax

Users hosts= (runas) commands

user:who, the identity of the running command

Host : where , through which Host

runas : (whom) , to which user is the identity , the default is Root User

Commands: which commands to run

(1) format

Users format: username , #uid , User_alias , %group_name , % #gid , User_alias

host format: ip hostname netaddr Span style= "Font-family:simsun;" >, host_alias

Command format : CommandName , Directory , Sudoedit ( can be used to grant sudo permission to other users ) , Cmnd_alias

(2) define aliases: Support to define multiple users, commands as a set of users

format:alias_type NAME = item1, item2, ...

NAME: All caps must be used;

Alias_type can be for User_alias , Host_alias , Runas_alias , Cmnd_alias

Note:

1) The full command path must be used because the environment variables of the normal user do not support /sbin Permissions

2) restrict normal users from changing Root Password: /usr/bin/passwd[a-z]*,!/usr/bin/passwd root

3. define the label:

You can define whether a password is used when executing ( command or executing the user ) when a command or user is defined

Common Tags:nopasswd,PASSWD

This article is from the "Xu Ding blog" blog, make sure to keep this source http://xuding.blog.51cto.com/4890434/1738045

The sudo command uses

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.