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

📄 rhl06.htm

📁 linux的初学电子书
💻 HTM
📖 第 1 页 / 共 3 页
字号:
<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE>System administration, because it deals with sensitive matters such as creating or deleting log-ins, requires superuser privileges. These privileges are provided by the root login. So, the sys-tem administrator is an actual person wielding superuser 
powers gained by logging in as root.</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<BR>

<A NAME="E69E37"></A>

<H4 ALIGN=CENTER>

<CENTER>

<FONT SIZE=4 COLOR="#FF0000"><B>Your First Login</B></FONT></CENTER></H4>

<BR>

<P>After all the cautions about using the root login, we're going to have you log in as root. Because root is the only authorized login on a newly installed Linux system, this is unavoidable. Also, we will be performing a couple of important procedures 
that require root privileges. However, after this first login, we will create a user ID that can prevent accidental damage to the operating system.

<BR>

<P>At the login prompt

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">darkstar login:</FONT></PRE>

<P>type

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">root</FONT></PRE>

<P>and press the Enter key.

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">Password:</FONT></PRE>

<P>Type in the root password that you set during installation and press the Enter key.

<BR>

<BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE>Linux is case-sensitive (as are all UNIX versions). A capital R is, to Linux, a completely different letter from a lowercase r. When you type Linux commands, you must use the proper case or Linux will not understand them. The majority of Linux 
commands are typed in lowercase. This includes the login root; if you type Root or rOoT, Linux will reject the login.

<BR>There is a curious exception, though. If you type the login IN ALL CAPITALS, the system will accept it&#151;but from then on, everything on your screen will be in capital letters! This is left over from the days when some terminals only had uppercase 
letters. Although these terminals are now all gone or in museums, the login program retains this historical curiosity.</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<P>After you have logged in as root, the system starts up a user session for you. At this point you should see the following on your screen:

<BR>

<PRE>

<FONT COLOR="#000080">darkstar login: root

Last login: Sun Dec 11 17:26:18 on tty1

Linux 1.2.13.

You have mail.

If it's Tuesday, this must be someone else's fortune.

darkstar:~#</FONT></PRE>

<P>Linux tells you when the login for this user was last recorded (although this information may not appear the very first time you log in), and then provides you with some version information. Linux also tells you that this login has a mail message 
waiting to be read. Finally, if games were installed on your system, Linux gives you a witty saying or aphorism.

<BR>

<P>It is always good practice to scan the line that starts with Last login, and check that the time given is correct. This is especially important if your Linux system is accessed by other users or connected to other systems. If the time given does not 
look right, it could be that someone is using the login to break into your system, or using your username without your permission.

<BR>

<P>We will read the mail message later, after taking care of some important steps. If you are curious, the same mail message is sent by the install procedure when the operating system is installed. It concerns registration matters for Linux.

<BR>

<P>Your &quot;fortune&quot; is chosen randomly from a long list, so don't expect to see the same one shown in the previous example. If you didn't install the games package during the Linux installation routine, you won't see a fortune. You can install the 
games package at any time.

<BR>

<P>The final line you see on the screen is the system prompt. This tells you that Linux is waiting for you to type in your commands&#151;it's prompting you for input. The system prompt also displays the following useful information:

<BR>

<UL>

<LI>darkstar is the system name.

<BR>

<BR>

<LI>The ~ character indicates your location in the file system (explained in <A HREF="rhl08.htm" tppabs="http://202.113.16.101/%7eeb%7e/Red%20Hat%20Linux%20Unleashed/rhl08.htm">Chapter 8</A>, &quot;The Linux File System&quot;).

<BR>

<BR>

<LI>The # character usually specifically indicates that you're logged in as root (although the $ sign is used in some operating systems which makes it difficult to quickly ascertain whether you are logged in as root or a regular user). According to UNIX 
conventions, regular user prompts are either % or $, depending on the shell; while # is reserved for root. These symbols are called shell prompts because they are used by the shell to prompt you for commands.

<BR>

<BR>

</UL>

<BR>

<A NAME="E68E35"></A>

<H3 ALIGN=CENTER>

<CENTER>

<FONT SIZE=5 COLOR="#FF0000"><B>Passwords</B></FONT></CENTER></H3>

<BR>

<P>In Linux (and just about all other UNIX systems) the superuser login name is root. No matter how humble or huge the system, if you can log in as root, the system is wide open for you to do whatever you want. Obviously, letting just anyone log in as root 
is unacceptable because it exposes the system to too much potential for serious damage.

<BR>

<P>To prevent unauthorized access, the root login should always have a password, and that password should be secure. You may have noticed that the Red Hat installation requested that you set a root password during the installation process. Some Linux 
installations do not set the root password; it is set to a null string, which is a word with no characters. With root and any other login, Linux does not bother asking for the password if it's the null string.

<BR>

<P>The null string is the least secure password there is, because anyone who knows a valid username (such as root) can access the system. It is up to you to change the password. Linux lets you choose what the new password will be, and accepts it without 
complaint. Unfortunately, this can lead to a false sense of security.

<BR>

<P>It was noticed a long time ago that users chose passwords that they could easily remember: their dog's name, their birthday, their hometown, their spouse's name, and so on. The problem is that these passwords were also easy to break, either through 
guessing or by more sophisticated means. This led some system administrators to insist on difficult-to-break, randomly picked passwords (such as S8t6WLk). People could not remember these passwords at all, so they wrote them down on pieces of paper and 
stuck them on their desks. Others, who were trying to break into the system, would find these pieces of paper and gain use of that login.

<BR>

<P>The best passwords are ones with a combination of uppercase letters, lowercase letters, and numbers, that are still easy to remember. Fri13th, 22Skidoo, and 2Qt4U are just a few examples. These hard-to-guess passwords are known as strong passwords, 
while easy-to-guess ones are called weak.

<BR>

<P>Of course, you should never use these exact passwords, or any other published sample passwords, because they're so easy to guess. There are many mischievous minds out there who, on strolling by a Linux system, might try root and Fri13th for the fun of 
it. You don't want to be the one with the nightmare of getting your system broken into.

<BR>

<P>For the best security, passwords should be changed every so often. Many system administrators recommend once every two or three months as reasonable. This guards against dictionary-based guessing attacks, and also minimizes damage in cases in which the 
password has been broken but nothing has really been done with it yet.

<BR>

<BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE>Don't leave your terminal unattended while you're logged in. The idly malicious may take the opportunity to make some changes to your files, or send a nasty mail message off to people you'd hate to alienate. Always log out or lock your terminal when 
you leave.</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<P>Of course, the amount of system security you require depends on how much access there is to your system, and how sensitive is the information found on it. The root password should always be a good, secure one. If nothing else, it will discourage you 
from casually logging on as root, especially if you leave your user logins with null passwords.

<BR>

<P>If you are using Linux at home for experimenting, much of the security worries mentioned previously may seem silly. However, it doesn't hurt to use good security, and the practice can be carried over to larger UNIX systems at work.

<BR>

<P>We must assign a password for the root login using the Linux command passwd. The spelling of the command has its history in the development of UNIX, when long commands, such as password, were avoided due to the number of characters that had to be typed! 
To change the root password at the system prompt, type the command passwd, and you see the following:

<BR>

<PRE>

<FONT COLOR="#000080">darkstar:~# passwd

Changing password for root

Enter new password:</FONT></PRE>

<P>At the prompt, type your new, secure password. What you type is not displayed on the screen. This keeps anyone looking over your shoulder (called &quot;shoulder surfing&quot;) from reading the password you've entered.

<BR>

<BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE>Make sure you type the password slowly and carefully! If any other user's password is lost or forgotten, it can be reset by the root login. But, if the root password is lost or forgotten, you must reinstall Linux.</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<P>Because it's so important that passwords are entered correctly, the system double-checks the spelling of the password for you by asking you to type it again:

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">Re-type new password:</FONT></PRE>

<P>Again, what you type is not displayed on the screen. If your two password entries match, you see the following:

<BR>

<PRE>

<FONT COLOR="#000080">Password changed.

darkstar:~#</FONT></PRE>

<P>The password is now changed in the system's configuration files. If the two entries do not match completely (remember, case is important), Linux gives you the message

<BR>

<BR>

<PRE>

<FONT COLOR="#000080">You misspelled it. Password not changed.</FONT></PRE>

<P>and changes are not made to the password. You need to start over with the passwd command.

<BR>

<BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE>Do not forget your new root password! Chant it to yourself before going to sleep, if necessary. But don't write it down on a piece of paper and slip it under the keyboard, either!</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<BLOCKQUOTE>

<BLOCKQUOTE>

<HR ALIGN=CENTER>

<BR>

<NOTE>If you want to leave a program right away and return to the shell prompt, try Ctrl-C (hold down 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.</NOTE>

<BR>

<HR ALIGN=CENTER>

</BLOCKQUOTE></BLOCKQUOTE>

<BR>

<A NAME="E68E36"></A>

<H3 ALIGN=CENTER>

<CENTER>

<FONT SIZE=5 COLOR="#FF0000"><B>Creating a New Login</B></FONT></CENTER></H3>

<BR>

<P>Now that you have assigned a password for the root account, the next thing you should do is 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.

<BR>

<P>Login names are used by 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. Login names can be any character or number string you want. 
Typically, login names bear a resemblance to the user's real name, so Joe Smith's login name may be joe, jsmith, or joes.

<BR>

<P>Linux has a utility called adduser, 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, a tedious 
and error-prone process.)

<BR>

<P>To create a user, at the shell prompt type adduser and the username you want to add.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -