📄 404-407.html
字号:
<HTML>
<HEAD>
<TITLE>Using Linux:Managing Users and Groups</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!--ISBN=0789716232//-->
<!--TITLE=Using Linux//-->
<!--AUTHOR=William Ball//-->
<!--PUBLISHER=Macmillan Computer Publishing//-->
<!--IMPRINT=Que//-->
<!--CHAPTER=25//-->
<!--PAGES=404-407//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="401-404.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="407-411.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<H4 ALIGN="LEFT"><A NAME="Heading4"></A><FONT COLOR="#000077">Adding a User with <I>usercfg</I>
</FONT></H4>
<P><FONT SIZE="+1"><B><I>How to add a new user</I></B></FONT></P>
<DL>
<DD><B>1.</B> Click the top button labeled Users to bring the user list back. The list of buttons on the bottom two rows show which functions are available. click the Add button to bring up a new Edit User Definition dialog box, as shown in Figure 25.3.
<P><A NAME="Fig3"></A><A HREF="javascript:displayWindow('images/25-03.jpg',322,283 )"><IMG SRC="images/25-03t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/25-03.jpg',322,283)"><FONT COLOR="#000077"><B>Figure 25.3</B></FONT></A> The Edit User Definition dialog box. Notice the defaults set by the system.</P>
<BR><TT>usercfg</TT> will automatically fill in the UID and GID for you. In our example, that is UID 514 and GID 514. In addition, <TT>usercfg</TT> fills in the Full Name field with a default string <TT>Red Hat Linux User</TT>. Finally, <TT>usercfg</TT> gives you the default shell setting to <TT>/bin/bash</TT>.
<DD><B>2.</B> Select a new login name. The login name should not be greater than eight characters. This should consist of only letters and numbers.
<DD><B>3.</B> Click the down arrow button next to the password entry. Select the second option, Change. This will bring up a dialog box like the one shown in Figure 25.4.
<P><A NAME="Fig4"></A><A HREF="javascript:displayWindow('images/25-04.jpg',308,105 )"><IMG SRC="images/25-04t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/25-04.jpg',308,105)"><FONT COLOR="#000077"><B>Figure 25.4</B></FONT></A> Change the entry.</P>
<DD><B>4.</B> Enter the password you want to assign to the user and press Enter. The dialog box will then prompt you to verify the password by reentering it. (The system wants to be sure that you haven’t made a typing mistake.) Enter the password again and press Enter. The first line of the dialog box will show the encrypted version of the string as in Figure 25.5.
<P><A NAME="Fig5"></A><A HREF="javascript:displayWindow('images/25-05.jpg',308,105 )"><IMG SRC="images/25-05t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/25-05.jpg',308,105)"><FONT COLOR="#000077"><B>Figure 25.5</B></FONT></A> Click the Done button to make that the password entry.</P>
<DD><B>5.</B> <TT>usercfg</TT> will have already filled in a UID and GID for you. If you want the user to be part of an existing group, provide that group number instead of the suggested one. Of course, you can always add that user to the group by editing the groups file, as you will see shortly.
<DD><B>6.</B> In the Full Name entry, fill in the complete name of the user. If the user wants to go by an alias, for example “Steveoid,” enter the alias here.
<DD><B>7.</B> The entries for Office, Office Phone, and Home Phone are optional. They are only used when the user is queried by other people using the <TT>finger</TT> command.
<DD><B>8.</B> In the Home Directory entry, specify where the user’s home directory will be. By default, the home directory will be <TT>/home/<I>login</I></TT> where <TT><I>login</I></TT> is the user’s login name. For most systems, this is acceptable and can be left alone. If you maintain a different home directory structure, replace this entry with the appropriate directory.
<DD><B>9.</B> In the default shell entry, specify which shell the user will use when he logs in. The default shell is <TT>/bin/bash</TT>, which is fine for most users. If the user wants a different shell, you can click the down arrow button to see a listing of available shells based on the contents of the <TT>/etc/shells</TT> file. If you want to give the user a shell not listed, simply erase the entry and enter whatever shell you want to assign them.
<DD><B>10.</B> After you have completed the dialog box, click the Done button. You should see your new entry in the main User Configurator window.
</DL>
<TABLE BORDER="2" BORDERCOLOR="#0000" ALIGN="CENTER">
<TR><TD>
<P><B>The difference between <I>login</I> and <I>username</I></B><BR>You will often find that people use the terms <I>login</I> and <I>username</I> interchangeably. Within most contexts, they mean the same thing.</TABLE>
</P>
<TABLE BORDER="2" BORDERCOLOR="#0000" ALIGN="CENTER">
<TR><TD><FONT SIZE="+1"><B>Password information</B></FONT>
<BR>Accounts should always have passwords. It is bad practice to leave accounts open to login without passwords, especially if your machine attaches to a network in any way. Furthermore, you need to use a good password—one that cannot be guessed using any of the automated password guessing programs available on the Internet.
<P>A good password is at least six characters long, contains a mixture of uppercase letters, lowercase letters, punctuation, and numbers. One good technique is to pick a phrase and use the first letter of each word in the phrase. This makes the password easy to remember but difficult to crack. For example, “Always remember, It’s a great big disco world” would be ArIagbdw.</TABLE>
</P>
<H4 ALIGN="LEFT"><A NAME="Heading5"></A><FONT COLOR="#000077">View/Edit Users</FONT></H4>
<P>After a user has been added, you might find it necessary to go back and edit his information. To bring up the Edit User Definition dialog box, follow these steps:
</P>
<P><FONT SIZE="+1"><B><I>Editing user settings</I></B></FONT></P>
<DL>
<DD><B>1.</B> Either double-click the user or click once on the user and click the View/Edit button at the bottom of the window. The Edit User Definition window looks just like the Add User window without the option to change the login name (see Figure 25.6).
<P><A NAME="Fig6"></A><A HREF="javascript:displayWindow('images/25-06.jpg',322,283 )"><IMG SRC="images/25-06t.jpg"></A>
<BR><A HREF="javascript:displayWindow('images/25-06.jpg',322,283)"><FONT COLOR="#000077"><B>Figure 25.6</B></FONT></A> The Edit User Definition dialog box. Note the striking similarity to the Add User dialog box.</P>
<DD><B>2.</B> Each field containing the user’s current information will be available for you to edit, except for the login name. You may change any of the other fields as you deem necessary.
<DD><B>3.</B> When you have finished making changes, click the Done button at the bottom of the active window. This will commit your changes to the system.
</DL>
<TABLE BORDER="2" BORDERCOLOR="#0000" ALIGN="CENTER">
<TR><TD><FONT SIZE="+1"><B>Don’t change the User Identification (UID)</B></FONT>
<BR>As mentioned earlier, you cannot change a user’s login name in the View/Edit dialog box. You have the option, however, to change the User ID (UID). <I>DON’T</I>. Changing a user’s ID number will cause a great deal of confusion because Linux associates file ownership to UID’s, not login names. Thus, changing a person’s UID will cause him to lose ownership of all of his files.
<P>If for whatever reason you need to do this, be sure you read the section later in this chapter on how to use the <tt>chown</tt> command to reassign ownership to files.</TABLE>
</P><P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="401-404.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="407-411.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
</td>
</tr>
</table>
<!-- begin footer information -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -