UNIX Groups

Use group -c at the UNIX prompt ($):

$ group -c groupname

groupname is a name you choose for your group. In order to display your groupname completely when listing files, it is suggested that you choose a groupname that is eight characters or fewer. For example, if you chose the name ourgroup as your groupname, you would type the following at the UNIX prompt:

$ group -c ourgroup

First, add yourself to the group by typing:

$ group -m groupname userid

At this point, you will be the sole group owner (since you created the group), meaning that only you can add and remove members from the group. To add other group owners, type:

$ group -o groupname userid

Likewise to remove a group owner, type:

$ group -O groupname userid

Note: There is a capital 'O' in the above command.

Add others' IDs in the same way as explained above. For example,

$ group -m ourgroup svl2

$ group -m ourgroup gd17

Likewise, to remove an ID's privileges, type:

$ group -M ourgroup svl2 (note the capital 'M')

Type group -i groupname to show the members of the group as well as other information about the group. For example:

$ group -i ourgroup

Note: The new group will not take effect until the next time you log in.

For more details, simply type group with no arguments at the $ prompt. If you are familiar with UNIX, you may note that this is a non-standard group command. Ours offers the functionality of multiple group owners but does not have password-protected groups or public groups. We changed from the 'classic' group command in June 2004.

At the UNIX prompt ($) type chgrp -R groupname . from within the directory you want to add to the group. This will add the directory itself as well as all files in that directory. Note the period (.) at the end of this command. For example:

$ cd /www/data/cu/directory

$ chgrp -R ourgroup

To force new files uploaded to a directory to have the same group designation as the directory, you must "turn the sticky bit on." For a particular directory type:

$ chmod g+s directory-name

where directory-name is, of course, the name of a directory.

If you need to turn on the sticky bit for your top level directory and all of directories beneath it, change directories to your top level web directory,

$ cd public_html

or if you are managing a website on the central servers, for example the Art History site,

$ cd /www/data/cu/arthistory

Then type

$ find . -type d -exec chmod g+s {} \;

To allow your group to change the files you've added to the group, it is necessary to change the protection to allow any kind of group access. Type the following at the UNIX prompt ($) within the file's directory: chmod -R g+rwX  . (note the period [.] at the end of this command). It is necessary to type this verbatim as UNIX is case-sensitive. For example:

$ cd /www/data/cu/directory

$ chmod -R g+rwX  .

To allow others to read group's Web files, use the standard UNIX chmod command. For example:

$ chmod a+rX filename

Or, to allow all the files in a directory to be public, use the UNIX wildcard asterisk (*):

$ chmod a+rX *

To check whether the file protections are changed correctly, use the ls command as follows:

$ ls -lag

You should see the following, for example:

-rw-rw-r-- 1 svl2 ourgroup 5183 Apr 7 16:12 test.html

The r's and w's at the left mean the file is readable and writeable by the owner (first set of rw) and the group (second set of rw), and readable by anyone (last r).st set of rw) and the group (second set of rw), and readable by anyone (last r).