Home  >  Article  >  Operation and Maintenance  >  Linux user management (2) about modifying user mode (picture)

Linux user management (2) about modifying user mode (picture)

黄舟
黄舟Original
2017-06-06 10:44:491344browse

Modifying the user mode can be achieved using the usermod command.

1. Introduction to common usermod commands:

-a: Only used with -G to add users to affiliated groups.

-d: Modify the directory when the user logs in. For example, when a general user logs in, the preset home directory will be entered by default. Sometimes it is more complicated to enter for the convenience of login. When entering the path, you can use this option to set the directory when entering.

-g: Modify the group to which the user belongs.

-G: Modify the additional groups to which the user belongs; you can use this option when changing the user's sudo permissions.

-s: Modify the shell version used after user login

2. Sudo permissions

There are two ways for users to obtain sudo permissions

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


2. The second method is to modify the user affiliation group:

You can use usermod or gpasswd to modify

(1) Use usermod to modify

$  sudo  usermod    -a  -G  sudo    tt

The modified results can be viewed in /etc/group, and you can see that the sudo column contains tt


## Possible files 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) Use gpasswd

Common commands:

-a:             Add the user to the specified group

-d:                                                                                                       . M Set the group member list

-A Set the group administrator list

For example:

Add tt as a sudo group member:

sudo  gpasswd   -a   tt    sudo

Add tt Delete from the sudo group:

sudo gpasswd  -d  tt  sudo

3. Solve the problem of having to enter a password every time you use sudo, which is too troublesome.

Solution:

Modify the /etc/sudoers file

The above is the detailed content of Linux user management (2) about modifying user mode (picture). For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn