DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Protecting files and directories

Owner, group, other

The permissions field of a file is divided into 1 + 3 + 3 + 3 places to allow you to set different permissions for different users. The first place (1) is reserved for file types such as ``d'' for directory and ``-'' for regular files. This is not user-specific. Each of the following sets of three applies to a particular set of users.

The first set of three permissions, after the place for d, applies to the owner of the file, the user whose name appears in the third field of the long listing.

The second set of three permissions applies to the all users who are members of the group of the file. (The group of a file is shown in the fourth field of a long listing.)

The third set of three permissions applies to others; that is, to everyone who is not the owner of the file, and is not a member of the group of a file.

These three sets of three permissions are known as owner, group, and other.

Q: What is a group?

A: Just as every person who uses the computer has a login name, every person is also a member of a group. Groups, together with group permissions, allow people who need to use the same files to share those files without sharing them with all other users.

For example, if you wrote a report that you wanted members of your department to read, but not everyone else in the company, you could set permissions like:

-rw-r-----   1 susannah techpubs      25 Jun 27 11:58 report
This would allow you to modify the file (the r and the w in the first set of three), allow other members of your group (here, techpubs) to read the file (the r in the second set of three), and prevent others from reading or modifying the file (the three hyphens in the third set of three). The first place contains a hyphen because report is a file, not a directory.

Q: How can I tell what group I am in?

A: The id(C) command shows you your login name and your group. Type id and press <Enter>. You see something like:

$ id
uid=12846(susannah) gid=1014(techpubs)
The computer is showing you your login name and group information in the way it thinks of them: as a UID (user identification), and a GID (group identification). The UID is a numeric representation of your login name; the GID is a numeric representation of your group. id shows the login name and group name in parentheses following the UID and GID.

Next topic: Changing the group of a file
Previous topic: -1

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003