
250 You Are Here
w – write access
x – execute access
Actions
+ – adds the permission
- – removes the permission
= – makes it the only permission
Want to test it out? Let’s remove all permission from sneakers.txt – for everyone.
chmod a-rw sneakers.txt
Now, let’s see if we can read the file:
[billy@localhost billy]$ cat sneakers.txt
cat: sneakers.txt: Permission denied
[billy@localhost billy]$
Guess it worked; even we can’t get into the file. But since the file belongs to us, we can always change
permission to allow us read and write access. (See Figure 16.19)
[billy@localhost billy]$ chmod u+rw sneakers.txt
[billy@localhost billy]$ cat sneakers.txt
buy some sneakers
then go to the coffee shop
then buy some coffee
bring the coffee home
take off shoes
put on sneakers
make some coffee
relax!
[billy@localhost billy]$
Here are some common examples of settings that can be used with chmod:
g+w – adds write access for the group
o-rwx – removes all permissions for others
Komentáře k této Příručce