HIGHLIGHTS |
||||
|
||||
UNIX FILE PERMISSION |
Unix File Permission: What Does It Mean? On Unix systems there are a limited number of users who can log in to the system (via Telnet, for instance). Each of these user has a unique user name and ID number. Every user belongs to a "group" with its own group name and group ID number. Every directory and every file on the system has one owner. If you are logged into the ystem, you can list the details of the files in your current directory by typing "ls -la". Among other things, this command will show the owner of each file and the name of thw owner's group. The "ls -la" command also shows the file or directory's access "permissions". Look at the sample file listing below: drwxrwxr-x 5 smith staff 1024 Apr 22 17:32 . drwxrwx--x 3 smith staff 1024 Jan 20 1998 .. -rwxr-xr-- 1 smith staff 466 Apr 21 1998 bonk The first two lines here refer to the current directory and its parent directory (the names are the same as in DOS). The third line shows the details for a file called "bonk". Both directories and the file are owned by "smith", who is a member of the "staff" group. The letters on the left of the list show the various "permissions" associated with each file or directory. The first letter is usually "d" for directory or left blank (or a hyphen) for a normal file. Then there are three sets of three letters each. The first set shows the owner's permissions, the second shows the group's permissions. The three third set shows the world's (everybody else's) permissions. The three letters in each set shows whether or not the files is readable, writable and/or executable. In the example, bonk is readable, writable and executable by "smith", readable and executable by the members of the "staff" group and read-only for the world. To change the permission on a file, you use the Unix "chmod" (change mode) command: chmod xyz filename x, y and z are numbers that specify the desired permissions. It is called "octal coding" where readable = 4; writable = 2; executable = 1. All you have to do is add up the values of the permissions you want to set, so that "rwxrw-r--" is set with this command: chmod 764 filename In other words, rwxrw-r-- is also 111110100 where 111 110 100 equals = 764 in binary. In binary, 0 is 0, 1 is 1, 10 is 2, 11 is 3, 100 is 4, 101 is 5, 110 is 6, 111 is 7 ...etc... It just takes some time to get used to it. |