Working with File Ownership and Permissions

The users and groups discussed in the previous section are useful only because each file on the system is owned by a certain user and group and because the system of file permissions can be used to restrict or control access to the files based on the user who is trying to access them.

The section that follows is a crash course in file permissions; we go into greater detail in Chapter 13.

If you look at a variety of files and directories from across the system and list them with the Is -l command, you can see different patterns of ownership and permissions. In each case, the output from the Is command is giving you several pieces of information: the permissions on the file expressed as a ten-place string, the number of links to the file, the ownership of the file (user and group), the size of the file in bytes, the modification time, and the filename. Of the ten places in the permissions string, the first differs from the others: The last nine can be broken up into three groups of three, representing what the user can do with the file, what members of the group can do with the file, and what others can do with the file, respectively. In most cases, these permissions are represented by the presence or absence of the letters r (read), w (write), and x (execute) in the three positions. So:

■ rwx means permission to read, write, and execute.

■ i means permission to read but not to write or execute.

■ r-x means permission to read and execute but not to write.

And so on.

j r - - r Permission to write to a file includes the right to overwrite or delete it.

So, for example:

Was this article helpful?

0 0

Post a comment