226 CHAPTER 14 UNDERSTANDING LINUX FILES AND (Web site domain)

226 CHAPTER 14 UNDERSTANDING LINUX FILES AND USERS Reading the file permissions from left to right, you see that the initial character is a dash. That indicates that this is an ordinary file and has no special characteristics. It s also not a directory. After that is the first part of the permissions, rw-. These are the permissions for owner of the file, keir. You re logged in as that user, so this file belongs to you, and these permissions apply to you. You can read and write the file, but not execute it. Because you cannot execute the file, you can infer that this is a data file rather than a program (there are certain exceptions to this rule, but we ll ignore them for the sake of simplicity). Following this is the next part of the file permissions, rw-. This tells you what other members of your group can do with the file. It s fairly useless information if you re the only user of your PC but, for the record, you re told that anyone else belonging to the group called keir can also read and write the file, but not execute it. If you re not the only user of a computer, group permissions can be important. The Altering Permissions section, coming up shortly, describes how to change file permissions to control who can access files. Finally, the last three characters tell you the permissions of everyone else on the system. The three dashes (—) mean that they have no permissions at all regarding the file. There s a dash where the r normally appears, so they cannot even read it. The dashes afterwards tell you they cannot write to the file or execute it. If they try to do anything with the file, they ll get a permission denied error. Permissions on a User s Directory Here s example number two: drwxr-xr-x 7 keir keir 824 2004-07-07 10:01 mydirectory The list of permissions starts with d, which tells you that this isn t a file but a directory. After this is the list of permissions for the owner of the directory (keir), who can read files in the directory and also create new ones there. The x indicates that you can access this directory, as opposed to being turned away with an access denied message. You might think being able to access the directory is taken for granted if the user can read and write to it, but that s not the case. Next are the permissions for the group members. They can read files in the directory but not write any new ones there (although they can modify files already in there, provided the permissions of the individual files allow this). Once again, there s an xat the end of their particular permission listing, which indicates that the group members can access the directory. Following the group s permissions are those of everyone else. They can read the directory and browse it, but not write new files to it, as with the group users permissions. Permissions on a Directory Owned by Root Here s the last example: drwx—— 25 root root 1000 2004-08-06 15:44 root

Leave a Reply