4.3 Working as Root

Because Debian is a multiuser system, it’s designed to keep any one

user or program from breaking the entire system. The kernel will not

allow normal users to change important system files. This means that

things stay the way they’re supposed to, safe from accidents,

viruses, and even malicious pranks. Unlike other operating systems,

Debian is safe from these threats. You won’t need an anti-virus

program.

However, sometimes you need to change important system files; for

example, you might want to install new software or configure your

network connection. To do so, you have to have greater powers than a

normal user; you must become the _root user_ (also called the

_superuser_).

To become root, just log on with the username root and the root

password; this was set during installation, as described in section

3.15 on page [*].

At many sites, only the system administrator has the root password,

and only the system administrator can do the things that one must be

root to do. If you’re using your own personal computer, _you_ are

the system administrator, of course. If you don’t have root

privileges, you will have to rely on your system administrator to

perform any tasks that require root privileges.

Sometimes you’ll have the root password even on a shared corporate

or educational server, because the system administrator trusts you

to use it properly. In that case, you’ll be able to help administer

the system and customize it for your needs. But you should be sure

to use the password responsibly, respecting other users at all

times.

If you have the password, try logging on as root now. Enter the

whoami command to verify your identity. Then _log out immediately_.

When you’re root, the kernel will not protect you from yourself,

because root has permission to do anything at all to the system.

Don’t experiment while you’re root. In fact, don’t do anything as

root unless absolutely necessary. This isn’t a matter of security,

but rather of stability. Your system will run much better if it can

keep you from making mistakes.

You may find the su command more convenient than logging in as root.

su allows you to assume the identity of another user, usually root

unless you specify someone else. (You can remember that su stands

for Super User, though some say it stands for Set UserID.)

Here’s something to try. Log on as yourself—that is, not as root.

Then your session will look something like the one in Figure 4.1.

[Illustration: Figure 4.1: Sample session with su]

When you’re doing system administration tasks, you should do as much

as possible as yourself. Then use su, do the part that requires root

privileges, and use the exit command to turn off privileges so you

can no longer harm anything.

You can use su to assume the identity of any user on the system, not

just root. To do this, type su _user_ where _user_ is the user you

want to become. You’ll have to know the user’s password, of course,

unless you’re root at the time or the user has no password.

Debian GNU/Linux : Guide to Installation and Usage · 第 75 / 193 题