Linux Commands for Beginners-- Changing Permissions --chmod command
阿新 • • 發佈:2018-12-30
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$
[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