Computing & Communications Center
Helpdesk

The CHMOD Command

AlphabeticalNumerical
u User 400 Read
Owner
g Group 200 Write
Owner
o Other 100 Execute
Owner
a All 40 Read
Group
r Read 20 Write
Group
w Write 10 Execute
Group
x Execute 4 Read
Others
2 Write
Others
1 Execute
Others

When working with files under Unix, it is possible to change the file permissions on them. Changing file permissions can dramatically increase the usefulness of the system for you in a variety of ways. For example, it can help you enhance the security of your home directory by allowing access to a file to yourself only. Or it can facilitate communication among a group, by allowing you to set a file to be readable by everyone on the system.

When changing permissions you can work alphabetically or numerically. For the alphabetical listings the + and - signs toggle permissions on or off. The = sign sets the permissions outright. Putting nothing after it turns all the permissions for the specified people off. To alter a file using the alphabetical characters you would enter:

chmod [group specification] [+ or -] [directory/filename]

With the numerical settings you add them together until you have the result you want, and then type:

chmod [number] [directory/filename]

The tables to the right of this text illustrate the alphanumerics necessary to alter the file permissions. Usage examples can be found below. For a list of standard permissions, please see the Standard Permissions table below.

For examples of chmod in action, visit the File Permissions for Web Pages page.

Standard Permissions
755 Used for directories and CGI files.
644 Used for regular HTML and image files.
Alphabetical Examples
chmod g+w [filename] Add write access for the group.
chmod go-w+x [directory/executable filename] Remove write access and allow execute access to the group and others.
chmod u=rwx,go= [filename] Give the user all access and no access to the group and others.
Numerical Examples
chmod 644 [filename] Read and write access to the user; read to the group and others.
chmod 664 [filename] Read and write access to the user and group, read to others.
chmod 755 [directory/executable filename] Read, write, and execute access for the user; read and execute for the group and others.
chmod 775 [directory/ executable filename] Read, write, and execute for the user; read, write, execute for the group; read and execute for others.
Maintained by itweb.
Last modified: Aug 22, 2011, 19:11 UTC
[WPI] [Home] [Back]