Boston University
Mathematics and Statistics
Mathematics and Statistics
Overview People Courses Programs of Study Seminars Special Programs Events Research Jobs
Mathematics and Statistics
 
next up previous contents
Next: File Types Up: File Permissions Previous: File Permissions
 

Changing Permissions on Files and Directories

To see what the file permissions are for your files, a variation to the ls command is available. The ls -l command produces the long listing of the files in the current directory. For example:
math joe % ls -lg

The first ten characters are codes that describe what the file permissions are. If the first column has a d in it then this indicates that this entry is a directory. The next nine characters are split into three sets of three characters each. The characters are r (read), w (write), x (execute). The first group of three shows what the current permissions are for the user of the file, whose name is listed in the third section (joe). The second set of three characters shows what the current permissions are for the group of users associated with this file, whose name is listed in the fourth section (thesisgrp). The third set of three characters shows what the current permissions are for everyone else, or the others with an account on the machine. Any column containing a -- means that this permission doesn't exist for that user.

The -g option to the ls command above shows the name of the group that has permissions on each file.

The default permissions on newly-created files are that the owner can read and write, and the group and others can read. The chmod command lets a person change these permissions. r (for read), w (for write), and x (for execute) are the three permissions that can be added or taken away from u (the user), g (the group), and o (the others). For example, let's say Joe creates a file called final.exam. When this file is created, it is readable by everyone and has the following permissions:

Joe would use the command:
math joe % chmod go-r final.exam
to change the permissions so that no one but himself could read it:

Permissions can also be added by using a + sign in place of the - with the chmod command.

Note: On the Math Department's machine there are two locally created programs that makes setting file permissions easier. Use the command public to give others permission to use and look at the contents of your files. The command private is used to remove read and execute permission from all other people on the system, so that noone can access your files. By default everyone can read a newly created file. Please take the proper precautions by changing the file permissions when you create a file that should be private.



next up previous contents
Next: File Types Up: File Permissions Previous: File Permissions



Tim Kohl
 
September 2004
Mathematics and Statistics
Boston University