Google +    Album

= 改變Linux檔案屬性 =

範例如下

-rwxrwxrwx 1 root root 2133 12月 1 2004 prelink
-rw-r--r--  1 root root 104 8月 13 2006 rpm
-rwxr-----  1 root root 121 8月 22 2005 slocate.cron
-rwxr-xr-x  1 root root 286 8月 14 2004 tmpwatch

以上的rwx,就是所謂的檔案屬性,
r (read contents in directory)讀取
w (modify contents of directory)寫入
x (access directory)執行

第一個rwx 代表 檔案擁有者之屬性

第二個rwx
代表 檔案所屬群組之屬性
第三個rwx
代表 其他人對此檔案之屬性

一般用數字表示
r:4、w:2、x:1

若是第一個的

-rwxrwxrwx 1 root root 2133 12月 1 2004 prelink
就是[4+2+1][4+2+1][4+2+1]=777

第二個
-rw-r--r--  1 root root 104 8月 13 2006 rpm
就是[4+2+0][4+0+0][4+0+0]=644

第三個
-rwxr-----  1 root root 121 8月 22 2005 slocate.cron
就是[4+2+1][4+0+0][0+0+0]=740

第四個
-rwxr-xr-x  1 root root 286 8月 14 2004 tmpwatch
就是[4+2+1][4+0+1][4+0+1]=755

知道這樣的道理後,
指令就只要這樣下

chmod 777 "檔案名稱"

這樣懂了吧...

沒有留言: