linux命令创建用户
时间: 2023-04-23 11:03:13 浏览: 144
要在Linux中创建用户,可以使用以下命令:
1. useradd:用于创建新用户。
例如,要创建名为“test”的用户,请使用以下命令:
```
useradd test
```
2. passwd:用于设置用户密码。
例如,要为“test”用户设置密码,请使用以下命令:
```
passwd test
```
3. usermod:用于修改用户属性。
例如,要将“test”用户的主目录更改为“/home/test”,请使用以下命令:
```
usermod -d /home/test test
```
4. userdel:用于删除用户。
例如,要删除“test”用户,请使用以下命令:
```
userdel test
```
以上是创建、设置、修改和删除用户的基本命令。在使用这些命令时,请确保以root用户身份登录。
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231044901.png)
![-](https://img-home.csdnimg.cn/images/20241231044833.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![docx](https://img-home.csdnimg.cn/images/20241231044901.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![docx](https://img-home.csdnimg.cn/images/20241231044901.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![txt](https://img-home.csdnimg.cn/images/20241231045021.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![docx](https://img-home.csdnimg.cn/images/20241231044901.png)
![docx](https://img-home.csdnimg.cn/images/20241231044901.png)
![text/plain; charset=iso-8859-1](https://img-home.csdnimg.cn/images/20250102104920.png)
![txt](https://img-home.csdnimg.cn/images/20241231045021.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)