CS155: Introduction to Unix

Spring 2018

Permissions

See this page as a slide show

Permissions

CS155 Permissions

Permissions, Ownership, and ls -l

% date >now
% mkdir zulu
% ls -l
total 4
-rw------- 1 cs155 class 29 Apr 22 12:15 now
drwx------ 2 cs155 class 40 Apr 22 12:15 zulu

Permissions in Detail

d rwx rwx rwx

drwxrwxrwx
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 chewbacca
give everyone permission only to read chewbacca. (-r--r--r--)
chmod go+xw darth
add group and other execute and write access to darth. (-????wx?wx)
chmod o-rwx han
take away read, write, and execute access from users not in group or user. (-??????---)
chmod u=rwx luke
give the user read, write, and execute access. (-rwx??????)

chmod: examples

% touch chewbacca darth luke han
% ls -l
total 0
-rw------- 1 cs155 class 0 Apr 22 12:15 chewbacca
-rw------- 1 cs155 class 0 Apr 22 12:15 darth
-rw------- 1 cs155 class 0 Apr 22 12:15 han
-rw------- 1 cs155 class 0 Apr 22 12:15 luke
% chmod ugo=r chewbacca
% chmod go+xw darth
% chmod o-rwx han
% chmod u=rwx luke
% ls -l
total 0
-r--r--r-- 1 cs155 class 0 Apr 22 12:15 chewbacca
-rw--wx-wx 1 cs155 class 0 Apr 22 12:15 darth
-rw------- 1 cs155 class 0 Apr 22 12:15 han
-rwx------ 1 cs155 class 0 Apr 22 12:15 luke

chmod: more examples

CommandResult
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--

User: Guest

Check: HTML CSS
Edit History Source

Modified: 2017-12-20T16:01

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