chmod 权限代码 -R 目录/文件:将某个目录以及目录下的所有子目录及文件都设置成对应权限(谨慎使用),如下;
chmod 765 -R dirchmod +x 文件:将某个文件设置成可执行,设置完后属主、数组和其他都变成可执行了,如下:
ll -rw-r--r-- 1 root root 787 11月 5 15:11 test.py chmod +x test.py ll -rwxr-xr-x 1 root root 787 11月 5 15:11 test.py此外,还有chmod u+x 文件等操作,如下:
# chmod u+x 文件: 仅授予这个文件属主可执行权限,如下操作 ll -rw-r--r-- 1 root root 787 11月 5 15:11 test.py chmod u+x test.py ll -rwxr--r-- 1 root root 787 11月 5 15:11 test.py # chmod g+x test.py: 仅授予文件test.py属组可执行权限 # chmod o+x test.py: 仅授予文件test.py其他可执行权限最后还是要多说一句,不要随意使用-R操作。
