Permissions

What does each bit mean?

ni[108]:ls -lad public_html                                                   ~
drwxr-xr-x  11 jgross   usr         1024 Dec 24 00:43 public_html

[user][group][other]

Read
Write
eXecute

For directories:

Read 	- Can see contents of directory
Write 	- Can create or delete files in directory
eXecute - Can enter directory (but not see contents)
Octal vs symbolic
chmod go+rw <directory>
chmod 755 <directory>
Useful modes
700	drwx------	Owner everything, Nothing for others
755	drwxr-xr-x	Owner everything, Others just read
711	drwx--x--x	Owner everything, Others can only cd into dir

600	-rw-------	Owner everything, Nothing for others
644	-rw-r--r--	Owner everything, Others can read
755	-rwxr-xr-x	Owner everything, Other can read and execute

the chmod(1) command

The chmod command is used to change the permission of a file. The basic syntax is:
chmod mode file
So, for example, say you have a file like this:
-rw-rw-r--   1 k-garner     exec        1319 Sep 17 18:12 permissions.html
You decide that you no longer want it to be writable by group exec:
chmod g-w permissions.html
Now the file looks like this:
-rw-r--r--   1 k-garner     exec        1319 Sep 17 18:12 permissions.html

Example: One easy command to make your homepage accessible:

chmod -R a+rX ~/public_html
Remember that Unix is case-sensitive!

See the chown(1) manpage for more details.


ACM@UIUC Main Page