This page explains how to use the built-in Linux file permissions to allow others to access your files. On EECS computers, however,we recommend using Access Control Lists (ACLs) instead because basic linux permissions cannot share a file with a single user. Instead, it shares files with all EECS users or with all of your default group (e.g. undergraduates).
Linux permissions define who can view and make changes to your files and directories. Each file/directory has nine permission bits, which can be viewed using the -l option to the ls command. Here is an example:
prompt> ls -l
-rw-rw-r-- 1 bob undrgrad 0 May 11 16:20 file1
-rw------- 1 bob undrgrad 0 May 11 16:20 file2
The first column in the example output lists ten permission bits – the first bit describes the type of file. The permissions are of the format “
rwxrwxrwx”. The first three bits are the owner’s permissions, the next three are the group’s permissions, and the last three are others’s (i.e., everyone else’s) permissions. The symbols have the following meanings:
||Has permission to read the file/directory.|
||Has permission to
||Has permission to
file1 from the example output above may be read and changed by bob, read and changed by anyone in the undrgrad group, and only read by anyone else.
file2 may be read and changed only by bob.
You can change the permissions on a file or directory you own using the
chmod command (derived from change mode).
chmod mode filename
The mode argument is a three-digit octal number describing the permissions for the owner, group, and others respectively. Here is a table showing the interpretation of the various digits:
Here are some examples:
chmod also accepts a mnemonic syntax for the mode argument. The three categories – owner, group, and others – are represented by
orespectively. Permissions can be added, removed, or copied by
-, and = respectively. Here are some examples:
||Adds write permission for the owner of the file.|
||Gives read/write permission to owner and group, and read permission to others.|
||Removes execute permission for all three categories (owner/group/others).|
||Makes the group permissions the same as the owner’s.|
||Adds read permission for the group to all files in the mydir directory. (The