📄 114-117.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=114-117//-->
<!--UNASSIGNED1//-->
<!--UNASSIGNED2//-->
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="111-114.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="117-119.html">Next</A></TD>
</TR>
</TABLE>
</CENTER>
<P><BR></P>
<P>Again, what you type is not displayed on the screen. If your two password entries match, you see the following:
</P>
<!-- CODE SNIP //-->
<PRE>
Password changed.
darkstar:~#
</PRE>
<!-- END CODE SNIP //-->
<P>The password is now changed in the system’s configuration files. The change is effective immediately, and your old password is discarded.
</P>
<P>If the two password entries you typed do not match completely (remember, case is important), Linux gives you a message similar to this one:</P>
<!-- CODE SNIP //-->
<PRE>
You misspelled it. Password not changed.
</PRE>
<!-- END CODE SNIP //-->
<P>and changes are not made to the password. You need to start over with the <TT>passwd</TT> command from the beginning.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>Tip: </B><BR>If you want to leave a program right away and return to the shell prompt, try <TT>Ctrl+C</TT> (hold the Ctrl key and press C; this is sometimes written as ^C). This usually terminates whatever program you’re in (usually without ill effects) and redisplays the shell prompt. For example, if you’re starting to change your password and haven’t thought of a good one, pressing <TT>Ctrl+C</TT> when Linux is asking for your new password terminates the routine and your old password is kept.<HR></FONT>
</BLOCKQUOTE>
<H3><A NAME="Heading8"></A><FONT COLOR="#000077">Creating a New Login</FONT></H3>
<P>Now that you have assigned a password for the <TT>root</TT> account, the next step is to create a login with which you can safely explore the Linux system and try out some of the basic commands covered in the following chapters. Some Linux systems ask you to create a user account when you are installing the system, but most don’t. Even if you did create a user login during installation, you’ll probably want to add more for friends, family, or for you to use for other purposes.</P>
<P>Linux has a utility called <TT>adduser</TT> which simplifies and automates the task of adding a new user to the system. (This isn’t how they did it in the good old days. You should be glad—in the past, files had to be manually edited to add users and all their associated information, a tedious and error-prone process.)</P>
<P>To create a user, at the shell prompt type the command <TT>adduser</TT>:</P>
<!-- CODE SNIP //-->
<PRE>
darkstar:~# adduser
Adding a new user. The username should be not exceed 8 characters
in length, or you many run into problems later.
Enter login name for new account (^C to quit):
</PRE>
<!-- END CODE SNIP //-->
<P>The prompts on your system may be slightly different, but they all approach the task of adding a user login the same way. Some Linux versions have full-screen utilities for the same task or make a utility available under a graphical windowing system that is a lot more attractive, but the bottom line is that the same information is required and must be entered by you.
</P>
<P>Login names are used by all valid system users. You can create a login for yourself that you will use permanently, or you can create a temporary login for exploring the system and remove it later. Unlike some multiuser systems such as Windows NT, you can create and delete logins as often as you want, even reusing the same login name over and over again.</P>
<P>The key to every account is the login name. Login names can be made of any character or number string you want, although in general you should limit the length of the name to eight characters (which allows portability over networks and the Internet). Typically, login names bear a resemblance to the user’s real name, so that Joe Smith’s login name may be <TT>joe</TT>, <TT>jsmith</TT>, or <TT>joes</TT>. It’s a good idea to keep a consistent naming principle, especially if you are going to have several users on your system (you’ll be surprised how many friends want accounts on your Linux system!).</P>
<P>With some versions of Linux, you have to specify the login name that you’re trying to create on the same line as <TT>adduser</TT>:</P>
<!-- CODE SNIP //-->
<PRE>
adduser joes
</PRE>
<!-- END CODE SNIP //-->
<P>If your system requires this, you’ll see an error message when you try to use the <TT>adduser</TT> command by itself.</P>
<P>At the <TT>adduser</TT> prompt, enter the login name that you want to create. It is advisable to use all lowercase letters to avoid confusion. Do not exceed the eight-character limit at this point. (Although a mixed case login can be useful for confusing people trying to hack into your system, it causes problems when your system tries to talk to others over a network.)</P>
<P>For our sample user account in this chapter, let’s create the user <TT>fido</TT>. (After all, as the joke goes, “On the Internet, no one knows if you’re a dog!”) Of course, you can substitute your choice on the screen in place of <TT>fido</TT> (unless you really like our login name).</P>
<!-- CODE SNIP //-->
<PRE>
Enter login name for new account (^C to quit): <B>fido</B>
Editing information for new user [fido]
Full Name:
</PRE>
<!-- END CODE SNIP //-->
<P>After entering the login name, a status message from the <TT>adduser</TT> utility usually appears, followed by a set of questions about the new user and the type of environment to present the account with when the user logs in. (The exact order of questions may be different, but usually most of the same information is requested.)</P>
<P>In the example previously shown, the <TT>adduser</TT> routine is waiting for the user’s real name. At this prompt, type the full name of the user. Uppercase, lowercase, mixed case, and spaces are fine. This information is not mandatory but is used by the system for some other tasks. Other users can also identify you with this name when you are on a network.</P>
<!-- CODE SNIP //-->
<PRE>
Full Name: <B>Fido Dog</B>
GID [100]:
</PRE>
<!-- END CODE SNIP //-->
<P>The system is waiting for you to provide a GID or <I>Group ID</I>, which is discussed in more detail in Chapter 35, “Users and Logins.” The last part of the prompt, <TT>[100]</TT>, means that it’s suggesting a GID of 100. This is the default choice and is good for most systems unless you are part of a larger network which has a naming policy in effect. For most users, the default is a great way to start and you can always change it later if you need to.</P>
<BLOCKQUOTE>
<P><FONT SIZE="-1"><HR><B>Tip: </B><BR>In this <TT>adduser</TT> utility and many other Linux programs, default choices are presented in square brackets. Simply press the Enter key to accept the default, or type the new value if you don’t want to accept the default value.
<P>Sometimes (as you will see later in the <TT>adduser</TT> utility) you are given two choices—usually <TT>y</TT> for yes and <TT>n</TT> for no—separated by a <TT>/</TT> or <TT>|</TT> character. The uppercase letter is the default choice which you can select by pressing Enter. The other choice must be typed explicitly. In the following examples, yes is always the default choice: <TT>[Y/n]</TT>, <TT>[Y|n]</TT>, <TT>[Yn]</TT>.</P>
<HR></FONT>
</BLOCKQUOTE>
<P><BR></P>
<CENTER>
<TABLE BORDER>
<TR>
<TD><A HREF="111-114.html">Previous</A></TD>
<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>
<TD><A HREF="117-119.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 + -