Permissions

GNU and Unix systems are set up to allow many people to use the same

computer, while keeping certain files private or keeping certain

people from modifying certain files. You can verify this for

yourself. Log in as yourself, i.e. _NOT_ as root.

whoami

This verifies that you are not root. Then enter the following

command:

rm /etc/resolv.conf

You should be told Permission denied. /etc/resolv.conf is an

essential system configuration file; you aren’t allowed to change or

remove it unless you’re root. This keeps you from accidentally

messing up the system, and if the computer is a public one (such as

at an office or school), it keeps users from messing up the system

on purpose.

Now type ls -l /etc/resolv.conf.

This will give you output that looks something like this:

-rw-r-r- 1 root root 119 Feb 23 1997 /etc/resolv.conf

The -l option to ls requests all that additional information. The

info on the right is easy: The size of the file is 119 bytes; the

date the file was last changed is February 23, 1997; and the file’s

name is

/etc/resolv.conf. On the left side of the screen, things are a

/little more

complicated.

First, the brief, technical explanation: The -rw-r-r- is the _mode_

of the file, the 1 is the number of hard links to this file (or the

number of files in a directory), and the two roots are the user and

group owning the file, respectively.

So that was cryptic. Let’s go through it slowly.

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