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

📄 117-119.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:
<HTML>

<HEAD>

<TITLE>Linux Unleashed, Third Edition:Getting Started</TITLE>

<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!--ISBN=0672313723//-->

<!--TITLE=Linux Unleashed, Third Edition//-->

<!--AUTHOR=Tim Parker//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Sams//-->

<!--CHAPTER=6//-->

<!--PAGES=117-119//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="114-117.html">Previous</A></TD>

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

<TD><A HREF="119-122.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<P>After the Group ID has been given, the <TT>adduser</TT> program wants even more information:</P>

<!-- CODE SNIP //-->

<PRE>

GID [100]:

Checking for an available UID after 100

First unused uid is 101

UID [101]:

</PRE>

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

<P>The <TT>adduser</TT> utility does not echo your Group ID choice to the screen if you simply press Enter. This can be a little disconcerting if you&#146;re not used to it, especially if you look back and try to figure out what you&#146;ve done. If you don&#146;t see anything, the default value is used. Most Linux commands don&#146;t echo what you have done, so this is a good time to get used to it.</P>

<P>The <TT>adduser</TT> utility now asks for a User ID or UID. In this case, Linux suggests a default value of 101. Again, the default is fine in this case, so simply press Enter. You can pick any number that isn&#146;t already in use, but there&#146;s not much point in changing either the GID or UID unless you have specific organizational reasons to do so.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>Note:&nbsp;&nbsp;</B><BR>The User ID is used by Linux whenever it is referring to something you have done. The operating system is designed to use a number rather than the full login name because it takes up less room and is easier to manipulate. The User ID is important and each login on the system has its own unique number. By convention, UIDs of less than 100 (500 on some versions) are special system UIDs; <TT>root</TT>&#146;s UID is 0. Regular users get UIDs starting at 100 (or 500).<HR></FONT>

</BLOCKQUOTE>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>Note:&nbsp;&nbsp;</B><BR>A few versions of Linux, such as Caldera&#146;s OpenLinux, don&#146;t bother asking you any questions at all when you use the <TT>adduser</TT> command. The <TT>adduser</TT> routine just finds the next GID and UID and assumes default values for all the rest of the information, too. While this is fast and easy, it does make configuring a login with nonstandard characteristics a bit more difficult.<HR></FONT>

</BLOCKQUOTE>

<P>The <TT>adduser</TT> utility then shows two more prompts asking for the user&#146;s home directory and the shell:</P>

<!-- CODE SNIP //-->

<PRE>

Home Directory [/home/fido]:

Shell [/bin/bash]:

</PRE>

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

<P>Choose the default values for <TT>Home Directory</TT> and <TT>Shell</TT>. You&#146;ll see more about directories in Chapter 9, &#147;File and Directory Permissions,&#148; and look at different shells in Chapter 11, &#147;<TT>bash</TT>,&#148; Chapter 12, &#147;<TT>pdksh</TT>,&#148; and Chapter 13, &#147;<TT>tcsh</TT>.&#148; The default values are suitable for most user IDs.</P>

<P>As a last step, the <TT>adduser</TT> program asks for a password for the new user. At the prompt, enter a suitable password. If you press Enter without typing anything else, the password is set to the same string as the login or a null password, depending on the version of Linux. These two approaches are not recommended, however, because they are easy to guess. Even a simple password is better than none.</P>

<!-- CODE SNIP //-->

<PRE>

Password [fido]:



Information for new user [fido]:

Home directory: [/home/fido] Shell: [/bin/bash]

uid: [501] gid: [100]



Is this correct? [y/N]:

</PRE>

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

<P>The <TT>adduser</TT> program now verifies that you are happy with all the information you have entered. If you are, type <TT>y</TT> for yes, and press Enter. The default value (shown by the capital letter) is <TT>N</TT> for no. If you choose the default, you are telling the script that the information displayed is not correct, and you have to start the whole process over again.</P>

<P>When you answer <TT>y</TT> to the question <TT>Is this correct?</TT>, the <TT>adduser</TT> program creates the new user&#146;s directory and adds the user information to the system configuration files. You may see the following information appear on the screen as the <TT>adduser</TT> utility does its work. When the utility has finished, you see the Linux shell prompt again:</P>

<!-- CODE //-->

<PRE>

Adding login [fido] and making directory [/home/fido]



Adding the files from the /etc/skel directory:

./.kermrc -&gt; /home/fido/./.kermrc

./.less -&gt; /home/fido/./.less

./.lessrc -&gt; /home/fido/./.lessrc

./.term -&gt; /home/fido/./.term

./.term/termrc -&gt; /home/fido/./.term/termrc

darkstar:~#

</PRE>

<!-- END CODE //-->

<P>We will look at how to remove unwanted users from your <TT>/etc/passwd</TT> file in Chapter 35, &#147;Users and Logins.&#148;</P>

<H3><A NAME="Heading9"></A><FONT COLOR="#000077">Logging Out</FONT></H3>

<P>Now that you have created a new user, you can use it in the next couple of chapters to explore Linux. To finish with your session as <TT>root</TT>, log out of the system by typing <B>logout</B>:</P>

<!-- CODE SNIP //-->

<PRE>

darkstar:~# <B>logout</B>



Welcome to Linux 1.2.13

darkstar login:

</PRE>

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

<P>You see the login prompt display again. At this point, you can log back in as <TT>root</TT> or as the new user you have just created.</P>

<P>Some systems allow you to log out with the <TT>Ctrl&#43;D</TT> sequence. If the shell you are using supports <TT>Ctrl&#43;D</TT> as a logout command, the login prompt reappears. Otherwise, you may see a message such as this:</P>

<!-- CODE SNIP //-->

<PRE>

Use &#147;logout&#148; to leave the shell.

</PRE>

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

<P>If you have used other UNIX systems before, you may be used to using <TT>Ctrl&#43;D</TT> to log out. The default shell used by Linux does not support <TT>Ctrl&#43;D</TT> unless the key mappings are changed to allow it. Some versions of Linux also allow the logoff command to be used with most shells.</P><P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="114-117.html">Previous</A></TD>

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

<TD><A HREF="119-122.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 + -