chmod操作

首先,要查看权限

  • 如果要查看某个文件的权限,运行ls -l filename
  • 如果要查看某个目录的权限,运行ls -ld dirname
  • 如果要查看当前目录下所有文件夹的权限,运行ls -l即可

然后,修改权限(以给予读/写/执行全部权限为例)

  • 如果要修改某个文件的权限,可以运行
    • chmod 777 filename,7,7,7分别对u(所有者),g(组内用户),o(其他用户)给予所有权限,其中7=4+2+1,数字对应关系为(4----r, 2----w, 1----x)
    • chmod ugo+rwx filename这种方式更加直观
  • 如果要修改某个目录的权限,可以运行
    • chmod -R 777 dirname

猜你喜欢

转载自blog.csdn.net/qq_37285386/article/details/107711384