Unix File Attributes

Earlier in this Appendix, in Section B.4.3, we described the Unix filesystem implementation, and said that the inode entries contain metadata: information about the file, apart from its name. It is now time to discuss some of these attributes because they can be highly relevant to users of the filesystem.

File Ownership and Permissions

Perhaps the biggest difference from single-user personal-computer filesystems is that Unix files have ownership and permissions.

Ownership

On many personal computers, any process or user can read or overwrite any file, and the term computer virus is now familiar to readers of almost any daily newspaper, even if those readers have never used a computer themselves. Because Unix users have restricted access to the filesystem, it is much harder to replace or destroy critical filesystem components: viruses are seldom a problem on Unix systems.

Unix files have two kinds of ownership: user and group, each with its own permissions. Normally, the owner of a file should have full access to it, whereas members of a work group to which the owner belongs might have limited access, and everyone else, even less access. This last category is called other in Unix documentation. File ownership is shown by the verbose forms of the ls command.

New files normally inherit owner and group membership from their creator, but with suitable permissions usually given only to system managers, the chown and chgrp commands can be used to change those attributes. ...

Get Classic Shell Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.