Linux new user and assign Administrator privileges

Source: Internet
Author: User


Enter Useradd create a new user

[Email protected] ~]# useradd zhengqi[[email protected]passwd Zhengqi

passwd is the command to modify the user password, here will be prompted to enter the password two times, the password is invisible.

Then modify the user belongs to the group, Wheel group is an administrator group, joined the wheel group, is equivalent to the user has been given administrator rights.

sudo usermod-g wheel Yaoqi

However, this setting requires a password for each use of the root permission, and you can modify the/etc/sudoers configuration file to set the root permission operation without entering the password.
Go to the root user, modify the/etc/sudoers profile, and first check the root permissions on this file:

[Email protected] ~]$ ll/etc/sudoers14187:/etc/ Sudoers

The root user only has Read permission on the file and needs to write to the root user.

chmod +w /etc/sudoers[[email protected]-devenv ~]# ll/etc/sudoers1 4188 Jul  7   /etc/sudoers

Executing chmod +w/etc/sudoers is the right to add write to the/etc/sudoers file for the current user. Then use VIM to modify the file.

vim/etc/ in Group wheel to run all commands%wheel  all=(All)       %wheel all= ( All)       Nopasswd:all

The # #Same thing without a password the next line of comments removed, you can set the root permission to do not enter the password when the operation (the note is very clear).
After the operation is complete, remember to recover root permissions.

chmod -w /etc/sudoers[[email protected]-devenv ~]# ll/etc/sudoers1 4187  - :/etc/sudoers

The new user is then logged in, although the Administrator user group is added, and sudo is required before the command to perform root operations.
For example: After logging into a newly created user, try vim/etc/sudoers to see nothing, sudo vim/etc/sudoers to see the contents of the profile.

Linux new user and assign Administrator privileges

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.