> For the complete documentation index, see [llms.txt](https://sugar-at.gitbook.io/blog-article/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sugar-at.gitbook.io/blog-article/linux/user-group.md).

# 5.用户管理

## 分类

* 超级用户:root,拥有最高权限 UID:0
* 普通用户:有一定权限限制,可以登录系统:UID:1000-60000
* 系统用户(伪用户):不会登陆系统一般.用于维持某个服务程序UID(1-999)

## 用户相关配置文件

* 账号:/etc/passwd
* 密码:/etc/shadow

## 添加用户

* 命令:useradd
* -u:指定uid
* -d:指定用户主目录
* -g:指定用户组
* -r:指定用户是系统用户
* -s:用户登录shell的解释器
* -M:不创建主目录

## 设置密码

* 命令:passwd username

## 删除用户

* 命令:userdel username

## 添加用户组

* 命令:groupadd

## 删除用户组

* 命令:groupdel


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://sugar-at.gitbook.io/blog-article/linux/user-group.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
