Changing groups (using the
newgrp command) does not change your directory path. Use the
cd command to change your directory path.
Similarly, changing directory paths, does not change groups.
If you work within groups, you should check the ownership of files periodically (perhaps once a month). If you accidentally create files intended for a group using the default group associated with your userid (for example, employee) those files will be deleted when you leave the College, unless you change the ownership.
groupscommand to display the ids of the groups you belong to.
newgrp groupidto change to work with files and directories owned by the specified groupid. Your userid must belong to the group.
If you have been working with a group id and wish to return to the files owned by your personal userid, type
ls -ldisplays a list of directory contents that includes: file type, security permissions, owner, size, creation date, and file name. Here's a sample:
% ls -l /html/depts/epid/bubonic total 9138 drwxrwxr-x 2 schulz epid 512 Jul 18 15:56 history/ -rw-rw-r-- 1 frank faculty 478082 Jul 18 15:56 imgmap.gif -rw-rw-r-- 1 schulz epid 17942 Jul 18 15:56 index.html -rw-rw-r-- 1 frank epid 457224 Jul 18 15:56 logo.gif drwxrwxr-x 2 jones epid 512 Jul 18 15:56 pathology/ -rw-rw-r-- 1 jones epid 22284 Jul 18 15:56 work-in-progress.htmlIn this example, the group
epidowns all the files except
imgmap.gif, which belongs to the personal userid of
frank, a faculty member, and will be deleted when he or she leaves the University.
A "d" in the first column (as in
history/) indicates a directory; a dash ("-") indicates a file; an "l" indicates a "link" (for example:
lrwxrwxrwx 1 frank faculty 18 Aug 14 12:56 public_html@ -> /html/home/frank/shows that
public_htmlis a link to
/html/home/frank/, which is on the fog.ccsf.cc.ca.us computer.
The next nine columns, in three groups of three, define read (r), write (w) and execute (x) permission for your userid (the first three columns), for the members of the group to which the files or directories belong (the second three columns), and for anyone logged onto the system (the third three columns).
Almost always, you want to have 'rw-' for your (the owner's) data files and 'rwx' for your programs and directories. And, for everyone, you'll probably want either 'r--' or '---', depending on whether or not it's OK for people to read your files, and 'r-x' for your directories.
If you work within groups, look closely to see which directories and files you want to keep control over and which you will allow the group to write to.
chmod command, described below, to change permissions.
chmodto change the read, write, and/or execute permissions of files.
The command has three parts:
g for the group
a for all
+ to add permission
- to remove permission
chmod g+r homework.html exams.html allows the group to read the files homework.html and exams.html, but not write to them chmod g+rwx openinfo grants read, write, and execute access to anyone in the group to files in the directory openinfoUse numeric codes to set multiple access permissions. For example,
664is the equivalent of setting both
644is the equivalent of setting both
775is the equivalent of setting both
755is the equivalent of setting both
a+rx. For example:
chmod 664 * allows members of the group to read and write and everyone to read all the files in the current directory chmod 755 images allows members of the group and everyone to read and execute the directory images (Web directories should be marked executable)
chgrp newgroup filenamewhere newgroup is name of the group you want the file associated with and filename is the name of the file. For example:
chgrp culinary salads changes ownership of the file salads to the group culinary chgrp culinary * changes ownership of all the files in the current directory to culinary
[Web Weaver] [CCSFweb] [CCSF Info] [Events] [Site Index] [Help]