Linux common commands-45: chmod

The chmod command is used to change the permissions of a file or directory. Only the owner of the file and the super user can execute this command. There are two setting modes, one is to use permission letters and operators; the other is to use numbers.

Syntax format: chmod [parameter] [file]

Common parameters:

Example

 # 给test.sh脚本加个执行的权限,a为针对所有用户。r为读,w为写,x为执行chmod a+x test.sh # 给文件夹test递归设置权限755,读权限为4,写为2,执行为1,加起来是7 chmod -R 755 test

This article is reprinted from https://xugaoxiang.com/2022/06/13/linux-cmds-45-chmod/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment