In unix, every file has a user id and a group id associated with it For example, the file /etc/passwd, shown by the command ls -l: -rw-r--r-- 1 root shadow 2286 Feb 15 19:05 /etc/passwd || | | | |-- group id || | | |-- user id || | |-- "other" permissions || |-- group permissions ||-- user permissions |-- flags The permissions consist of the letters r, w, and x. r is read permission, w is write permission, and x is execute permission. flags - Flags for the file. For example, d is directory. user permissions - Permissions for the user id associated with the file In the example shown, root has read and write permissons on the file group permissions - Permissions for the user id associated with the file In the example shown, anybody in the shadow gruop can read the file other permissions - Permissions for cases where neither the user id nor the group id match the user accessing the file. For example, if the user 'bob' who is in the 'users' group accesses this file, the other permissions would apply. In the example shown, other users can read the file user id - The user id of the file, used to determine permissions group id - The group id of the file, used to determine permissions Changing associated user ids and group ids be accomplished with the chown command. The ids are set by specifying the user id and the group id, seperated by colons. If the group id is ommitted, it is left untouched. If the user id is ommitted, the colon must appear before the group id. Examples (note that the # signifies a prompt, and is not part of the command): To change the user id of the file /etc/services to 'bob': # chown bob /etc/services To change the group id of the file /etc/services to 'users': # chown :users /etc/services To change the user id of the file /etc/services to 'jim' and the group id to 'users': # chown jim:users /etc/services Changing permissions can be accomplished with the chmod command. Permissions consist of three numbers from 0 to 7. The numbers are, in order, user permissions, group permissions, and other permissions. If any of these numbers is ommitted, they are assumed to be 0. The numbers can be obtained by adding the desired permissions. The permissions are: 1 - execute permission 2 - write permission 4 - read permission Examples: To give anybody with the same user id read and write permission, but nobody else any access to the file 'secret': # chmod 600 secret To make the file 'game' writable, readable, and executable by anyone with the same user id, but only readable and executable to everybody else: # chmod 755 game Quick reference: -rw-r--r-- 1 root shadow 2286 Feb 15 19:05 /etc/passwd ^^ ^ ^ ^ ^ || | | | | || | | | +-- group id || | | +-- user id || | +-- "other" permissions || +-- group permissions |+-- user permissions +-- flags To change owners: chown To change access: chmod Permission reference: 1 - Execute (run) permission 2 - Write permission 4 - Read permission Notes: Users can be in more than one group Delete permission is attained with write access to the directory Directory permissions can be viewed with ls -ld directory