# 账号

### 添加用户

```
useradd {{ 用户名 }}
```

### 添加用户组

```
groupadd -g {{ 用户组id }} {{ 用户组 }}
```

### 为用户添加用户组

```
usermod -a -G {{ 用户组 }} {{ 用户名 }}
```

{% hint style="info" %}
`-a`表示为只添加用户组，不加`-a`时会覆盖掉其他用户组
{% endhint %}

### 为用户设置登录密码

```
passwd {{ 用户 }}
```

### 免密码认证

编辑/etc/sudoers

```
# 使指定用户在使用sudo运行命令时无需输入密码
{{ 用户名 }} ALL=(ALL:ALL) NOPASSWD:ALL
```

### 使用sudo su时缺少/etc/profile中的环境变量

在\~/.bachrc中添加source /etc/profile语句


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://viva.gitbook.io/project/sui-bi/linux/zhang-hao.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
