chmod-Permissions

chmod用于改变文件和目录的权限

给指定文件的属主和属组所有权限(包括读、写、执行)

$ chmod ug+rwx file.txt

删除指定文件的属组的所有权限

$ chmod g-rwx file.txt

修改目录的权限,以及递归修改目录下面所有文件和子目录的权限

$ chmod -R ug+rwx file.txt

更多示例:7 Chmod Command Examples for Beginners

# Permission  File                       | Directory
# r read     Allows a file to be read.   | Allowd file names in the directory to be read.   
# w write    Allows a file to be modified. | Allows entries to be modified within the directory.
# x execute  Allow the exexution of a file | Allows access to contents and metadata for entries.

#Permission Categories
#u    User
#g    Group
#o    Other
#a    All

#display a user's groups
groups
#or 
id -Gn

Umask

Last updated