UW Unix Group Permissions Help Page
INTRODUCTION
Having to deal with file permissions at all is a pain, but since we need to do it in order to make sure we can all edit each other's work and keep outsiders from destroying it, let's try and minimize the pain as much as possible so we can concentrate instead on what is really important: the content our pages. There are two situations we face when dealing with file permissions: (1) Setting the file permissions on a new file and (2) maintaining those permissions from then on whenever the file is editted thereafter. Under the system I propose, accomplishing the first task only requires having to type a single word ONCE at the end of your editting session, and accomplishing the second task requires ABSOLUTELY NO WORK; it will be handled automatically.
THE SYSTEM
Maintaining existing file permissions is easy; just add a "umask 002" to your ".mycshrc" file. Setting up the file permissions on a new file, on the other hand, is a little more involved. The naive way to do this would be to "chmod 0775" each individual file you create. A better way would be to just do a "chmod -R 0775 *" from the main parent directory once at the end of your editting session; this prevents you having to navigate the Unix file structure and set the permissions on each individual file. An even better way is to define a one word alias in your ".cshrc" file that will contain "chmod -R 0775 /MainParentDirectory/*"; this way you just type the one word from any directory location and you can rest assured that all files have been set to the appropriate file permissions.
SETTING UP THE SYSTEM
#1 Editting your ".cshrc" file so it loads your (arbitrarily named) ".mycshrc" file each time you log on. Go into your personal account on June and type "emacs .cshrc". Emacs is the Unix text editor we'll use to modify the ".cshrc" file. Scroll down to the bottom of the file and make sure add the following text if it is not already present:
if (-f ${HOME}/.mycshrc) then source ${HOME}/.mycshrc
Finish by saving the file.
#2 Edit your ".mycshrc" file so it contains the "umask 002" and the chmod alias declaration. Load your ".mycshrc" file (it will be created when you load it if it is not already created). Then add the following text:
alias permit 'chmod -R 0775 /OurProjectsMainDirectoryName/*' umask 002
where "permit" is the name of the alias. Save the file and exit out of emacs.
That's it! The umask will now protect the permissions on any existing file you edit and just type "permit" at the end of any work session where you have created one or more new files and all file permissions will be set appropriately.
ADDITIONAL INFORMATION ON UNIX FILE PERMISSIONS
Sets file permissions for a given file.
syntax: "chmod -option OCTAL filename"
options:
OCTAL:
Four digit number representing permissions. 1 = execute, 2 = write, 4 = read where numbers are added together, hence 7 = execute permission and write permission and read permission. Also, 5 = execute permission and read permission.
Therfore 0775 gives all permissions to owner and group and execute and read permission to everyone else.
Prevents your default file permission settings from affecting files you edit.
syntax: "umask OCTAL"
OCTAL:
Similar to chmod in that composed of 3octal digits corresponding to last 3 digits of chmod octal number (owner, group, world). The way it works is as follows: each digit is converted to 3 binary digits, complement of which is then ANDed with your default setting for file permissions. As if they could of made it any more archaic. So when you say "002", it is mapped to "000 000 010", which when complemented becomes "111 111 101" which when ANDed with the your default becomes "rwx rwx r0x", which basically means the file's permisisons will be set to your default permissions witt the exception that it will not be writable by the world.
This command changes the file's group owner. Cleverly enough, it doesn't change the file's group permissions, but rather gives members of the group other than the file's personal owner the ability to set the file's permissions.
syntax: "chgrp -OPTION groupName filename"
OPTION:
This lets you take personal ownership of a file if you are in the group which owns it.
syntax: "chown filename"
List files.
syntax "ls -OPTIONS"
OPTIONS: