⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 411-414.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 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=411-414//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="407-411.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="414-417.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H4 ALIGN="LEFT"><A NAME="Heading9"></A><FONT COLOR="#000077">Adding a Group</FONT></H4>

<P>To add a new group, do the following:

</P>

<P><FONT SIZE="+1"><B><I>Adding a group</I></B></FONT></P>

<DL>

<DD><B>1.</B>&nbsp;&nbsp;Click the Groups button at the top of the User Configurator window. The window will show the current listing of groups in the system, similar to Figure 25.10.

<P><A NAME="Fig10"></A><A HREF="javascript:displayWindow('images/25-10.jpg',491,335 )"><IMG SRC="images/25-10t.jpg"></A>

<BR><A HREF="javascript:displayWindow('images/25-10.jpg',491,335)"><FONT COLOR="#000077"><B>Figure 25.10</B></FONT></A>&nbsp;&nbsp;The User Configurator when listing groups.</P>

<DD><B>2.</B>&nbsp;&nbsp;Click the Add button at the bottom of the window. This will bring up the Edit Group Definition window similar to the one shown in Figure 25.11.

<P><A NAME="Fig11"></A><A HREF="javascript:displayWindow('images/25-11.jpg',322,151 )"><IMG SRC="images/25-11t.jpg"></A>

<BR><A HREF="javascript:displayWindow('images/25-11.jpg',322,151)"><FONT COLOR="#000077"><B>Figure 25.11</B></FONT></A>&nbsp;&nbsp;The Edit Group Definition dialog box.</P>

<DD><B>3.</B>&nbsp;&nbsp;Enter the name you want to call your new group. Like a login name, group names cannot be longer than eight characters and can only consist of letters and numbers.

<BR>Note: The next two steps are identical to the steps used to set the password when adding a user. The figures used to describe this process in the &#147;Adding a User&#148; section (Figures 25.4 and 25.5) apply here as well.

<DD><B>4.</B>&nbsp;&nbsp;Click the down arrow button next to the password entry. Select the second option, Change.

<DD><B>5.</B>&nbsp;&nbsp;Enter the password you want to assign 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&#146;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. Remember! Linux is case sensitive! You <I>must</I> enter the password exactly the same way both times, with the exact same mix of capital and lowercase letters!

<DD><B>6.</B>&nbsp;&nbsp;Click the Done button to make that the password entry.

<DD><B>7.</B>&nbsp;&nbsp;The GID entry will be prefilled in with the next available GID and can be left alone.

<DD><B>8.</B>&nbsp;&nbsp;The user list is a comma-separated list of the users whom you want to be part of this group. For example, if the users sshah, heidi, and jnguyen are working on a new project, you could create a group for them and have each login listed as a member. When they use the <TT>newgrp</TT> command to switch into that group, they will not have to give a password to gain access.

<DD><B>9.</B>&nbsp;&nbsp;After you have completed the form, click the Done button. The new group should appear in the User Configurator window.

</DL>

<H4 ALIGN="LEFT"><A NAME="Heading10"></A><FONT COLOR="#000077">Editing an Existing Group</FONT></H4>

<P>To edit an existing group, do the following:

</P>

<P><FONT SIZE="+1"><B><I>Editing groups</I></B></FONT></P>

<DL>

<DD><B>1.</B>&nbsp;&nbsp;Click the Groups button at the top of the User Configurator window.

<DD><B>2.</B>&nbsp;&nbsp;Click once on the group&#146;s entry to highlight it and then click the View/Edit button at the bottom of the User Configurator window. 

<DD><B>3.</B>&nbsp;&nbsp;Make the changes you want to the group&#146;s information. It should be noted that changing the value of the GID will cause confusion because files will need their group ownership reset. In general, the only changes you need to make to a group after it is created is to either add or delete users who are members of the group. Remember that the list of users who are members of a group must be comma separated.

<DD><B>4.</B>&nbsp;&nbsp;Click Done to finalize changes.

</DL>

<H4 ALIGN="LEFT"><A NAME="Heading11"></A><FONT COLOR="#000077">Removing a Group</FONT></H4>

<P>Removing a group is even simpler than removing a user.

</P>

<P><FONT SIZE="+1"><B><I>Removing groups</I></B></FONT></P>

<DL>

<DD><B>1.</B>&nbsp;&nbsp;Click the Groups button at the top of the User Configurator window.

<DD><B>2.</B>&nbsp;&nbsp;Click the group you want removed.

<DD><B>3.</B>&nbsp;&nbsp;Click the Remove button at the bottom of the User Configurator window. The group will be removed immediately.

</DL>

<H4 ALIGN="LEFT"><A NAME="Heading12"></A><FONT COLOR="#000077">Finishing Up with <I>usercfg</I>

</FONT></H4>

<P>Unless otherwise mentioned, the changes you make with the <TT>usercfg</TT> program will not take effect until you explicitly click the Save button at the bottom of the User Configurator window. After you have saved your changes, you can click Quit to exit the User Configurator.</P>

<H3><A NAME="Heading13"></A><FONT COLOR="#000077">Adding, Editing, and Deleting Users Using the Command Line</FONT></H3>

<P>Unfortunately, it isn&#146;t always possible to use a graphical tool such as <TT>usercfg</TT> to manipulate users. In these instances, you should be familiar with the command-line versions of these tools called <TT>useradd</TT>, <TT>usermod</TT>, and <TT>userdel</TT> for adding, modifying, and deleting users, respectively.</P>

<H4 ALIGN="LEFT"><A NAME="Heading14"></A><FONT COLOR="#000077">Adding Users with <I>useradd</I>

</FONT></H4>

<P>To add a user with the useradd command, log in to the root account and enter the following command:

</P>

<!-- CODE SNIP //-->

<PRE>

[root&#64;in宻oc /root]# useradd -d <I>homedir</I> -s /bin/tcsh [ic]

                  -c &#147;<I>User&#146;seal Name</I>&#148; <I>newlogin</I>

</PRE>

<!-- END CODE SNIP //-->

<P>where <TT><I>homedir</I></TT> is the home directory of the user being created,<TT><I>User&#146;s Real Name</I></TT> is the real name of the user. (Be sure to have the user&#146;s name inside the double quotation marks.) And finally, <TT><I>newlogin</I></TT> is the login name of the user being added.</P>

<P>Study this example:</P>

<!-- CODE SNIP //-->

<PRE>

[root&#64;insoc /root]# useradd -d /home/sshah -s /bin/tcsh [ic]

            -o &#147;Steve Shah&#148; sshah

</PRE>

<!-- END CODE SNIP //-->

<P>See the <TT>man</TT> page regarding <TT>useradd</TT> for the complete details on all the options available.</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="407-411.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="414-417.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 + -