📄 users-modifying.html
字号:
<li><p>Removes the user's home directory (if it is owned by the user).</p></li><li><p>Removes the incoming mail files belonging to the user from <ttclass="FILENAME">/var/mail</tt>.</p></li><li><p>Removes all files owned by the user from temporary file storage areas such as <ttclass="FILENAME">/tmp</tt>.</p></li><li><p>Finally, removes the username from all groups to which it belongs in <ttclass="FILENAME">/etc/group</tt>.</p><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> If a group becomes empty and the group name is the same as the username,the group is removed; this complements the per-user unique groups created by <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=adduser&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">adduser</span>(8)</span></a>.</p></blockquote></div><br /><br /></li></ol></div><p><a href="http://www.FreeBSD.org/cgi/man.cgi?query=rmuser&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">rmuser</span>(8)</span></a> cannot beused to remove superuser accounts, since that is almost always an indication of massivedestruction.</p><p>By default, an interactive mode is used, which attempts to make sure you know what youare doing.</p><div class="EXAMPLE"><a id="AEN18247" name="AEN18247"></a><p><b>Example 13-3. <tt class="COMMAND">rmuser</tt> Interactive Account Removal</b></p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">rmuser jru</kbd>Matching password entry:jru:*:1001:1001::0:0:J. Random User:/home/jru:/usr/local/bin/zshIs this the entry you wish to remove? <kbd class="USERINPUT">y</kbd>Remove user's home directory (/home/jru)? <kbd class="USERINPUT">y</kbd>Updating password file, updating databases, done.Updating group file: trusted (removing group jru -- personal group is empty) done.Removing user's incoming mail file /var/mail/jru: done.Removing files belonging to jru from /tmp: done.Removing files belonging to jru from /var/tmp: done.Removing files belonging to jru from /var/tmp/vi.recover: done.<samp class="PROMPT">#</samp></pre></div></div><div class="SECT2"><h2 class="SECT2"><a id="USERS-CHPASS" name="USERS-CHPASS">13.6.3 <ttclass="COMMAND">chpass</tt></a></h2><p><a href="http://www.FreeBSD.org/cgi/man.cgi?query=chpass&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">chpass</span>(1)</span></a> changes userdatabase information such as passwords, shells, and personal information.</p><p>Only system administrators, as the superuser, may change other users' information andpasswords with <a href="http://www.FreeBSD.org/cgi/man.cgi?query=chpass&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">chpass</span>(1)</span></a>.</p><p>When passed no options, aside from an optional username, <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=chpass&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">chpass</span>(1)</span></a> displays aneditor containing user information. When the user exists from the editor, the userdatabase is updated with the new information.</p><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> In FreeBSD 5.X, you will be asked for your password after exitingthe editor if you are not the superuser.</p></blockquote></div><div class="EXAMPLE"><a id="AEN18276" name="AEN18276"></a><p><b>Example 13-4. Interactive <tt class="COMMAND">chpass</tt> by Superuser</b></p><pre class="SCREEN">#Changing user database information for jru.Login: jruPassword: *Uid [#]: 1001Gid [# or name]: 1001Change [month day year]:Expire [month day year]:Class:Home directory: /home/jruShell: /usr/local/bin/zshFull Name: J. Random UserOffice Location:Office Phone:Home Phone:Other information:</pre></div><p>The normal user can change only a small subset of this information, and only forthemselves.</p><div class="EXAMPLE"><a id="AEN18281" name="AEN18281"></a><p><b>Example 13-5. Interactive <tt class="COMMAND">chpass</tt> by Normal User</b></p><pre class="SCREEN">#Changing user database information for jru.Shell: /usr/local/bin/zshFull Name: J. Random UserOffice Location:Office Phone:Home Phone:Other information:</pre></div><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> <a href="http://www.FreeBSD.org/cgi/man.cgi?query=chfn&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">chfn</span>(1)</span></a> and <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=chsh&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">chsh</span>(1)</span></a> are just linksto <a href="http://www.FreeBSD.org/cgi/man.cgi?query=chpass&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">chpass</span>(1)</span></a>, as are <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=ypchpass&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ypchpass</span>(1)</span></a>, <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=ypchfn&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ypchfn</span>(1)</span></a>, and <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=ypchsh&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">ypchsh</span>(1)</span></a>. NIS supportis automatic, so specifying the <var class="LITERAL">yp</var> before the command is notnecessary. If this is confusing to you, do not worry, NIS will be covered in <ahref="network-servers.html">Chapter 23</a>.</p></blockquote></div></div><div class="SECT2"><h2 class="SECT2"><a id="USERS-PASSWD" name="USERS-PASSWD">13.6.4 <ttclass="COMMAND">passwd</tt></a></h2><p><a href="http://www.FreeBSD.org/cgi/man.cgi?query=passwd&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">passwd</span>(1)</span></a> is the usualway to change your own password as a user, or another user's password as thesuperuser.</p><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> To prevent accidental or unauthorized changes, the original password mustbe entered before a new password can be set.</p></blockquote></div><div class="EXAMPLE"><a id="AEN18322" name="AEN18322"></a><p><b>Example 13-6. Changing Your Password</b></p><pre class="SCREEN"><samp class="PROMPT">%</samp> <kbd class="USERINPUT">passwd</kbd>Changing local password for jru.Old password:New password:Retype new password:passwd: updating the database...passwd: done</pre></div><div class="EXAMPLE"><a id="AEN18327" name="AEN18327"></a><p><b>Example 13-7. Changing Another User's Password as the Superuser</b></p><pre class="SCREEN"><samp class="PROMPT">#</samp> <kbd class="USERINPUT">passwd jru</kbd>Changing local password for jru.New password:Retype new password:passwd: updating the database...passwd: done</pre></div><div class="NOTE"><blockquote class="NOTE"><p><b>Note:</b> As with <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=chpass&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">chpass</span>(1)</span></a>, <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=yppasswd&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">yppasswd</span>(1)</span></a> is just alink to <a href="http://www.FreeBSD.org/cgi/man.cgi?query=passwd&sektion=1"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">passwd</span>(1)</span></a>, so NISworks with either command.</p></blockquote></div></div><div class="SECT2"><h2 class="SECT2"><a id="USERS-PW" name="USERS-PW">13.6.5 <ttclass="COMMAND">pw</tt></a></h2><p><a href="http://www.FreeBSD.org/cgi/man.cgi?query=pw&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">pw</span>(8)</span></a> is a commandline utility to create, remove, modify, and display users and groups. It functions as afront end to the system user and group files. <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=pw&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">pw</span>(8)</span></a> has a verypowerful set of command line options that make it suitable for use in shell scripts, butnew users may find it more complicated than the other commands presented here.</p></div></div><h3 class="FOOTNOTES">Notes</h3><table border="0" class="FOOTNOTES" width="100%"><tr><td align="LEFT" valign="TOP" width="5%"><a id="FTN.AEN18139" name="FTN.AEN18139"href="users-modifying.html#AEN18139"><span class="footnote">[1]</span></a></td><td align="LEFT" valign="TOP" width="95%"><p>The <var class="OPTION">-s</var> makes <ahref="http://www.FreeBSD.org/cgi/man.cgi?query=adduser&sektion=8"><spanclass="CITEREFENTRY"><span class="REFENTRYTITLE">adduser</span>(8)</span></a> default toquiet. We use <var class="OPTION">-v</var> later when we want to change defaults.</p></td></tr></table><div class="NAVFOOTER"><hr align="LEFT" width="100%" /><table summary="Footer navigation table" width="100%" border="0" cellpadding="0"cellspacing="0"><tr><td width="33%" align="left" valign="top"><a href="users-user.html"accesskey="P">Prev</a></td><td width="34%" align="center" valign="top"><a href="index.html"accesskey="H">Home</a></td><td width="33%" align="right" valign="top"><a href="users-limiting.html"accesskey="N">Next</a></td></tr><tr><td width="33%" align="left" valign="top">User Accounts</td><td width="34%" align="center" valign="top"><a href="users.html"accesskey="U">Up</a></td><td width="33%" align="right" valign="top">Limiting Users</td></tr></table></div><p align="center"><small>This, and other documents, can be downloaded from <ahref="ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/">ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/</a>.</small></p><p align="center"><small>For questions about FreeBSD, read the <ahref="http://www.FreeBSD.org/docs.html">documentation</a> before contacting <<ahref="mailto:questions@FreeBSD.org">questions@FreeBSD.org</a>>.<br />For questions about this documentation, e-mail <<ahref="mailto:doc@FreeBSD.org">doc@FreeBSD.org</a>>.</small></p></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -