linux基礎命令-chgrp/chown/chomd
阿新 • • 發佈:2017-08-22
linux基礎命令 賬號 lena chown comm 權限 內存 col bash 數字類型改變文件權限
chgrp 改變所屬用戶組
要被改變的組名必須要在/etc/group文件內存在才行;
chgrp [-R] dirname/filename
-R:進行遞歸的持續更改,連同子目錄下的所有文件、目錄都更新為新的用戶組
chown 改變文件所有者
如果要連目錄下的的所有子目錄或文件 都同時更改文件所有者的話,直接加上-R參數即可
chown [-R] 賬號名稱 文件或目錄
chown [-R] 賬號名稱:組名 文件或目錄
chown [-R] 賬號名稱.組名 文件或目錄
chmod 改變權限
數字類型改變文件權限
[[email protected] tmp]# ll total 4 drwxr-xr-x. 2 root root 4096 Aug 22 06:11 foo [[email protected] tmp]# chmod 000 foo/ [[email protected] tmp]# ls foo [[email protected] tmp]# ll total 4 d---------. 2 root root 4096 Aug 22 06:11 foo [[email protected] tmp]# chmod777 foo/ [[email protected] tmp]# ll total 4 drwxrwxrwx. 2 root root 4096 Aug 22 06:11 foo [[email protected] tmp]# chmod 641 foo/ [[email protected] tmp]# ls foo [[email protected] tmp]# ll total 4 drw-r----x. 2 root root 4096 Aug 22 06:11 foo [[email protected] tmp]#chmod 755 foo/ [[email protected] tmp]# ll total 4 drwxr-xr-x. 2 root root 4096 Aug 22 06:11 foo [[email protected] tmp]#
符號類型改變文件權限
[[email protected] tmp]# chmod u=rwx,g=rw,o=rw /tmp/foo/ [[email protected] tmp]# ll total 4 drwxrw-rw-. 2 root root 4096 Aug 22 06:11 foo [[email protected] tmp]# chmod u=rx,g+x,o-rw /tmp/foo/ [[email protected] tmp]# ll total 4 dr-xrwx---. 2 root root 4096 Aug 22 06:11 foo [[email protected] tmp]# chmod ugo=rw /tmp/foo/ [[email protected] tmp]# l -bash: l: command not found [[email protected] tmp]# ll total 4 drw-rw-rw-. 2 root root 4096 Aug 22 06:11 foo [[email protected] tmp]# chmod ug=rw,o-rw /tmp/foo/ [[email protected] tmp]# ll total 4 drw-rw----. 2 root root 4096 Aug 22 06:11 foo [[email protected] tmp]#
linux基礎命令-chgrp/chown/chomd