Linux User Management (2)----Modify user mode (Usermod,sudo permissions, etc.)

Source: Internet
Author: User

Modifying the consumer mode can be accomplished using the USERMOD command.


First, usermod commonly used command introduction:


-A: Use only with-G to add users to the affiliate group.


-D: Modify the user login directory, such as the normal user login, the default into the pre-set home directory, some times in order to facilitate the login need to enter a more complex path, you can use this option to set the entry-time directory.


-G: Modifies the group to which the user belongs.


-G: Modify the additional group to which the user belongs, and use this option when changing the user's sudo permissions.


-S: Modify the shell version used by the user after login


Two, sudo permissions

Users get sudo permissions and can use two ways

1. Modify the/etc/sudoers file to add the user name to the sudo permission group, for example



2. The second option is to modify the user's affiliate group:


Can be modified using USERMOD or GPASSWD


(1) Modify with Usermod

$ sudo usermod-a-g sudo tt

After the modified results can be viewed/etc/group, you can see that the sudo column contains the TT



Files that may be involved:

FILES
/etc/group
Group account information.


/etc/gshadow
Secure group account information.


/etc/passwd
User account information.


/etc/shadow
Secure user account information.


(2) using GPASSWD

Common commands:

-A: Adding users to the specified group

-D: Remove the user from the specified group


Other options:

-M sets the group member list

-A sets the list of administrators for the group

For example:

Add TT to the sudo group member:


sudo gpasswd-a tt sudo


Remove the TT from the sudo group:


sudo gpasswd-d tt sudo



Third, to solve every use of sudo need to enter a password, too much trouble.


Workaround:

Modify the/etc/sudoers file






Linux User Management (2)----Modify user mode (Usermod,sudo permissions, etc.)

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.