Linux Power Distribution-sudo

Source: Internet
Author: User

Sudo is a very useful tool on the Unix/linux platform that allows system administrators to assign a reasonable "power" to ordinary users to perform tasks that only superuser or other privileged users can accomplish (mainly as commands), such as running some like Mount,halt, Commands such as Su,useradd, Userdel, or edit some system configuration files, such as/etc/mtab,/etc/samba/smb.conf, etc. This has not only reduced the number of logins and administrative time of the root user, but also improved the security of the system.


If you do not give an ordinary user a right, even with the sudo command before using the command, it still does not work.

[Email protected] ~]$ useradd XX
-bash:/usr/sbin/useradd: Insufficient Authority
[[email protected] ~]$ sudo useradd xx
We Trust you are received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) with great power comes great responsibility.
[sudo] password for book:
Book isn't in the sudoers file. This incident would be reported.

[Email protected] book]# vim/etc/sudoers

Method of distribution of rights:

The distribution of power is mainly by adding a line of information in the configuration file/etc/sudoers in the agreed format. (Configure the file to be configured as root)
User Name Host name = (run user name) command to run

Example 1. Book all= (All)/usr/sbin/useradd//Assume that there is a user in the system, giving useradd rights to it
Example 2. Book all= (All) NOPASSWD:/usr/sbin/useradd//No password Authentication required

After switching to book user, execute sudo useradd xx//ordinary user book can add a user xx


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.