See this page as a slide show
Permissions, Ownership, and ls -l
% ls -l
-r-xr-xr-x 1 smith under 235 Dec 18 12:22 program1
-rw------- 1 applin fac 4 Jan 19 14:43 my_file2
drwx------ 2 applin fac 4096 Jan 19 14:44 new_dir
- Every file and directory in the file system is owned by
some user and belongs in some group.
- Generally, a file is owned by whoever created it and belongs
to that user’s default group.
Permissions in Detail
d rwx rwx rwx
|directory or file||user||group||other|
- First column: d means a directory, - means a file.
- Next three: permissions for the user (owner) of the file
- Next three: permissions for the group (similar people)
- Last three: permissions for others (everybody else)
The permissions can be different for user, group and other (everyone else).
Typically, the user gets the most permissions,
and others get very little.
Permissions: What do they mean?
r: gives permission to read a a file or directory
w: gives you permission to write a file or directory
x: gives you permission to execute (run) a file
cd into a directory
w for a directory means that you can change the directory,
not the files it contains. Changing the files underneath it depends
rwx: list, modify (add or remove files), and cd
r-x: list and cd
---: no access
- a file that can only be read
- a file that can be read by everyone but only written by the owner
and group members
chmod: Changing Permisions
chmod : change mode
- Often we will want to grant or restrict access of certain files
or directories. We can do this in two ways:
- We can add or subtract permissions for the
user, group, and others.
- We can also set all permissions at once.
chmod mode[,mode]… file…
mode is formed by combining:
o (or combination thereof), or
a for “all”
- modify symbol:
- Put commas between the modes—no spaces here!
chmod ug+wx gives user and group write and execute permissions.
It doesn’t change the other permissions.
chmod ugo=r darth
- give everyone permission only to read
chmod go+xw luke
- add group and other execute and write access to
chmod o-rwx han
- take away read, write, and execute access from users not in group or user.
chmod u=rwx chewbacca
- give the user read, write, and execute access.
chmod: more examples
chmod a=r,go+w ackbar
chmod a=rwx,g-w,o-x ewok
chmod a=rw,go-w,o-r yoda
chmod u=rw boba
chmod a=rw,go= lando
chmod og=r,u=rw r2d2