天天看點

LINUX檔案權限

[root@Freedom1991 test1]# cp /root/test/file  test1  複制檔案到

[root@Freedom1991 test1]# ls

file.ln  test1

 

[root@Freedom1991 ~]# cp -ax test test1   複制所有的目錄及包含的目錄

[root@Freedom1991 ~]# ls

anaconda-ks.cfg  install.log  install.log.syslog  linux  test  test1  公共的  模闆  視訊  圖檔  文檔  下載下傳  音樂  桌面

[root@Freedom1991 ~]# mv test/file  test1/lover  将檔案移動并重命名

[root@Freedom1991 ~]# 

檔案權限: 四種

讀 r  4

寫  w  2 

執行 x  1

無     0

chmod修改檔案權限:

drwxr-xr-x    2 root root  4096 9月  30 13:57 linux 

[root@Freedom1991 /]# chmod -R 777 /linux  

[root@Freedom1991 /]# ls -l

drwxrwxrwx    2 root root  4096 9月  30 13:57 linux

[root@Freedom1991 /]# chmod -R 000 /linux

d---------    2 root root  4096 9月  30 13:57 linux

[root@Freedom1991 /]# chmod -R u+w,g+r,o+x /linux

d-w-r----x    2 root root  4096 9月  30 13:57 linux

[root@Freedom1991 /]# chmod -R u+rwx,g-w,o-x /linux

drwxr-----    2 root root  4096 9月  30 13:57 linux

如果檔案中還有其他子目錄要使用 -R

chown 改變檔案所者

[root@Freedom1991 /]# chown root.dn123456  /linux

drwxr-----    2 root dn123456  4096 9月  30 13:57 linux

[root@Freedom1991 /]# chown dn123456.dn123456  /linux

drwxr-----    2 dn123456 dn123456  4096 9月  30 13:57 linux

繼續閱讀