5

Linux常用命令-45:chmod

 1 year ago
source link: https://xugaoxiang.com/2022/06/13/linux-cmds-45-chmod/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

chmod 命令用来改变文件或目录的权限,只有文件的属主和超级用户才能执行这个命令。有两种设置模式,一种是采用权限字母和操作符;另一种是采用数字。

语法格式: chmod [参数] [文件]

常用参数:

95df138dfd5f6e44.png
# 给test.sh脚本加个执行的权限,a为针对所有用户。r为读,w为写,x为执行
chmod a+x test.sh

# 给文件夹test递归设置权限755,读权限为4,写为2,执行为1,加起来是7
chmod -R 755 test

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK