Permissions
文件權限編號的手冊頁
是否有文件權限編號的手冊頁?
我特地講
r = 4 w = 2 x = 1
我永遠記不住它們,每次我需要設置除 755 之外的權限時,我都必須用Google搜尋它。我認為我也不孤單,因為甚至有一個網站可以為你計算數字。
我剛剛意識到手冊頁
chmod
沒有任何數字描述,我無法弄清楚其他頁面會有它們。我想一個info
頁面也可以工作,因為它顯然是預先安裝的(我有拱門;我原以為我必須自己安裝那個——顯然不是)。如果我可以參考一個“線上”手冊頁(我使用 ‘on-line’ 中使用的意義man man
),那對我來說會容易得多。
man chmod
很可能會給你命令行工具。這可能包括一些容易錯過的文本第二個數字選擇擁有文件的使用者的權限:讀取 (4)、寫入 (2) 和執行 (1)
如果你這樣做了,
man 2 chmod
那麼你會得到真正完成工作的系統呼叫。這更難閱讀,但確實包含了神奇的數字:S_IRUSR (00400) read by owner S_IWUSR (00200) write by owner S_IXUSR (00100) execute/search by owner ("search" applies for direc- tories, and means that entries within the directory can be accessed) S_IRGRP (00040) read by group S_IWGRP (00020) write by group S_IXGRP (00010) execute/search by group S_IROTH (00004) read by others S_IWOTH (00002) write by others S_IXOTH (00001) execute/search by others
它還提供了一些其他的魔法值:
S_ISUID (04000) set-user-ID (set process effective user ID on execve(2)) S_ISGID (02000) set-group-ID (set process effective group ID on execve(2); mandatory locking, as described in fcntl(2); take a new file's group from parent direc- tory, as described in chown(2) and mkdir(2)) S_ISVTX (01000) sticky bit (restricted deletion flag, as described in unlink(2))