1. 程式人生 > >linux 命令系列之使用者與組、預設許可權(6)

linux 命令系列之使用者與組、預設許可權(6)

chown : change file ownership 更改檔案的所屬使用者

                chown  [使用者名稱]   [檔案/目錄]

                chown   user1     /tmp/canglaoshi      或  chown user1 /tmp/canglaoshi/

chgrp:  change file group owership 更改檔案的所屬組

                chgrp   [使用者名稱]    [檔案/目錄]

                chgrp     root      /tmp/canglaoshi   或   chgrp    root    /tmp/caolaoshi/

umask: the use file-creation mask  預設使用者建立檔案、目錄許可權

                輸入 umask  -S   得到結果u=rwx,g=rx,o=rx (755)

                輸入 umask        得到結果  0 022    (即777-755)

                若要是建立檔案有指定的許可權 eg: rwxr--r-- (即:744) 用 777-744 得到033

                再使用 umask 033  那麼現在建立的檔案就是744的許可權