CS155: Introduction to Unix

Fall 2017


See this page as a slide show


CS155 Permissions

Permissions, Ownership, and ls -l

% ls -l
total 8
-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

Permissions in Detail

d rwx rwx rwx

directory or fileusergroupother

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?

Note that w for a directory means that you can change the directory, not the files it contains. Changing the files underneath it depends on their w bits.

Permissions: Examples

chmod: Changing Permisions

chmod: use

chmod mode[,mode]… file…

mode is formed by combining:

chmod ug+wx gives user and group write and execute permissions. It doesn’t change the other permissions.

chmod: examples

chmod ugo=r darth
give everyone permission only to read darth. (-r--r--r--)
chmod go+xw luke
add group and other execute and write access to luke. (-????wx?wx)
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. (-rwx??????)

chmod: more examples

chmod a=r,go+w ackbar -r--rw-rw-
chmod a=rwx,g-w,o-x ewok-rwxr-xrw-
chmod a=rw,go-w,o-r yoda-rw-r-----
chmod u=rw boba -rw-??????
chmod a=rw,go= lando -rw-------
chmod og=r,u=rw r2d2 -rw-r--r--

Modified: 2016-09-09T12:53

User: Guest

Edit History Source
Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2015 Colorado State University
CS Building