Ordinary users to configure sudo privileges

Add a user: useradd username (only root users)

Set a password for the user to add: passwd username

           Follow the prompts to set a password

See all users: cat / etc / passwd

To delete a user: userdel -r spark -r says to add a user and the user's home directory are deleted, without the user will only be deleted from the configuration file but the user's home directory and data are still

       Need to exit before deleting command: exit

 

Tom add a user, provided it belongs to the group users, and add annotations

Step by step to complete: useradd tom

     usemod -g users tom

     usemod -c "hr tom" tom

One step: useradd -g users -c "hr tom" tom

Tom set a user's password: passwd tom

 

Modify the user's login name is tom tomcat: usermod -l tomcat tom

The tomcat added to the group sys and root: usermod -G sys, root tomcat

View tomcat group information: groups tomcat

 

Add a group called america's: groupadd america

Jerry america will add to the group: usermod -g america jerry

The tomcat user is removed from the root and group sys Group: gpasswd -d tomcat root

                 gpasswd -d tomcat sys

The group name changed to america am: aroupmod -n am america

 

Sudo permissions configured for the user (sudo: ordinary users is being used in this section in order to obtain administrator privileges to run, when this command is executed completely automatically return to normal user privileges)

vi / etc / sudoers (need to be configured before use sudo): editor as root

In the following location of the file, you can add a line to hadoop

root     ALL=(ALL)       ALL

hadoop       ALL=(ALL)      ALL

Then, hadoop sudo user can use to perform system-level instructions: [hadoop @ shizhan ~] $ sudo useradd huangxiaoming

Guess you like

Origin www.cnblogs.com/chengting/p/11494690.html