1. 程式人生 > >Linux Commands for Beginners-- Changing Permissions --chmod command

Linux Commands for Beginners-- Changing Permissions --chmod command


Example:
   
[email protected]:~/Documents/tutorial$ ls -l
total 0
-rw-rw-r-- 1 jack piniheaven 0 Aug 25 21:42 essay.txt
[email protected]:~/Documents/tutorial$
sudo chmod u+x essay.txt #give user the permission to execute essay.txt
[sudo] password for piniheaven: 
[email protected]:~/Documents/tutorial$ ls -l

total 0
-rwxrw-r-- 1 jack piniheaven 0 Aug 25 21:42 essay.txt


[email protected]:~/Documents/tutorial$ sudo chmodu-r essay.txt  #remove user's permission of reading essay.txt
[email protected]:~/Documents/tutorial$ ls -l
total 0
--wxrw-r-- 1 jack piniheaven 0 Aug 25 21:42 essay.txt


[email protected]:~/Documents/tutorial$
sudochmod uo+r essay.txt#give user and others the permission of reading essay.txt
[email protected]:~/Documents/tutorial$ ls -l
total 0
-rwxrw-r-- 1 jack piniheaven 0 Aug 25 21:42 essay.txt




[email protected]:~/Documents/tutorial$ sudo chmod a=x essay.txt#assign user,group and others only the permission to execute essay.txt

[email protected]:~/Documents/tutorial$ ls -l
total 0
---x--x--x 1 jack piniheaven 0 Aug 25 21:42 essay.txt