扩展用户和组操作指令.

Signed-off-by: rick.chan <chenyang@autoai.com>
This commit is contained in:
rick.chan 2020-05-12 10:28:01 +08:00
parent e2a451d730
commit 1f6d4b6d4f
1 changed files with 55 additions and 3 deletions

View File

@ -25,14 +25,66 @@ userdel -r <user name>
groupdel <group name> groupdel <group name>
``` ```
## 查看用户所属组 ## 组操作
### 将用户添加到组
```sh
gpasswd --add <user name> <group name>
```
### 从组中删除用户
```sh
gpasswd -d <user name> <group name>
```
### 查看用户所属组
```sh ```sh
groups <user name> groups <user name>
``` ```
## 将用户添加到组 ### 修改组名
```sh ```sh
gpasswd --add <user name> <group name> groupmod -n <new group name> <group name>
```
## 用户操作
### 为用户设置密码
```sh
passwd <user name>
```
### 显示用户信息
```sh
id <user name>
```
### 修改用户名
```sh
usermod -l <new user name> <user name>
```
### 修改用户 Home 目录
```sh
usermod -d <new home dir> <user name>
```
### 修改用户 ID
```sh
usermod -u <new ID> <user name>
```
### 更改用户信息
```sh
chfn <user name>
``` ```