CS155 Permissions
% 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
d | rwx | rwx | rwx |
directory or file | user | group | other |
The permissions can be different for user, group and other (everyone else). Typically, the user gets the most permissions, and others get very little.
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
or cd
into a directory
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.
drwxr-x---
rwx
: list, modify (add or remove files), and cd
r-x
: list and cd
---
: no access
-r--r--r--
-rw-rw-r--
chmod
: change mode
chmod
mode[,mode]… file…mode is formed by combining:
u
, g
, or o
(or combination thereof), or a
for “all”
+
, -
, or =
r
, w
, x
chmod ug+wx
gives user and group write and execute permissions.
It doesn’t change the other permissions.
chmod ugo=r darth
darth
.
(-r--r--r--
)
chmod go+xw luke
luke
.
(-????wx?wx
)
chmod o-rwx han
-??????---
)
chmod u=rwx chewbacca
-rwx??????
)
Command | Result |
---|---|
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 Check: HTML CSSEdit History Source |
Apply to CSU |
Contact CSU |
Disclaimer |
Equal Opportunity Colorado State University, Fort Collins, CO 80523 USA © 2015 Colorado State University |