# newusers

用于批处理的方式一次创建多个命令

## 补充说明

**newusers命令** 用于批处理的方式一次创建多个命令。

### 语法

```
newusers(参数)
```

### 参数

用户文件：指定包含用户信息的文本文件，文件的格式要与`/etc/passwd`相同。

### 实例

实用newusers命令批量添加用户：

用法很简单，newusers后面直接跟一个文件，文件格式和`/etc/passwd`的格式相同。

```
用户名1:x:UID:GID:用户说明:用户的家目录:所用SHELL
```

举例：

```
jingang0:x:520:520::/home/jingang0:/sbin/nologin
jingang1:x:521:521::/home/jingang1:/sbin/nologin
......
```

值得一提的是关于SHELL类型，查看主机上所有SHELL，可以通过chsh来查看：

```
[root@localhost beinan]# chsh --list
/bin/sh
/bin/bash
/sbin/nologin
/bin/ksh
/bin/tcsh
/bin/csh
/bin/zsh
```

其中除了`/sbin/nologin`，其它类型的SHELL都能登录系统，nologin大多是虚拟用户用的SHELL，也就是说虽然他是系统用户，但他并无登录系统的权限；如果您想添加这类用户，就把他的SHELL设置成`/sbin/nologin`，比如上面的例子。

关于用户名、UID、GID及用户的家目录是怎么回事，您可以读相应的参考文档。


---

# 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://hezhiqiang.gitbook.io/linux/ming-ling/newusers.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.
