uTools-Manuals/docs/linux/newusers.html
2019-04-21 11:50:48 +08:00

29 lines
1.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1 id="newusers">newusers</h1>
<p>用于批处理的方式一次创建多个命令</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>newusers命令</strong> 用于批处理的方式一次创建多个命令。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">newusers(参数)</code></pre>
<h3 id="参数">参数</h3>
<p>用户文件:指定包含用户信息的文本文件,文件的格式要与<code>/etc/passwd</code>相同。</p>
<h3 id="实例">实例</h3>
<p>实用newusers命令批量添加用户</p>
<p>用法很简单newusers后面直接跟一个文件文件格式和<code>/etc/passwd</code>的格式相同。</p>
<pre><code class="language-bash">用户名1:x:UID:GID:用户说明:用户的家目录:所用SHELL</code></pre>
<p>举例:</p>
<pre><code class="language-bash">jingang0:x:520:520::/home/jingang0:/sbin/nologin
jingang1:x:521:521::/home/jingang1:/sbin/nologin
......</code></pre>
<p>值得一提的是关于SHELL类型查看主机上所有SHELL可以通过chsh来查看</p>
<pre><code class="language-bash">[root@localhost beinan]# chsh --list
/bin/sh
/bin/bash
/sbin/nologin
/bin/ksh
/bin/tcsh
/bin/csh
/bin/zsh</code></pre>
<p>其中除了<code>/sbin/nologin</code>其它类型的SHELL都能登录系统nologin大多是虚拟用户用的SHELL也就是说虽然他是系统用户但他并无登录系统的权限如果您想添加这类用户就把他的SHELL设置成<code>/sbin/nologin</code>,比如上面的例子。</p>
<p>关于用户名、UID、GID及用户的家目录是怎么回事您可以读相应的参考文档。</p>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->