使组权限与用户权限相同

Mat*_*hew 40 permissions chmod

我想将某个父目录中所有文件和子目录的组权限设置为该特定文件或目录的用户权限设置。

例如,下面的所有内容 /path/to/parentdir

# Permissions before
# Path                      Permissions
/path/to/parentdir/file1    755
/path/to/parentdir/file2    644
/path/to/parentdir/file3    600

# Permissions after
/path/to/parentdir/file1    775
/path/to/parentdir/file2    664
/path/to/parentdir/file3    660
Run Code Online (Sandbox Code Playgroud)

我希望有一种简单的方法可以在一个命令中做到这一点。我可以想到使用带有一堆命令的脚本的方法,但感觉应该有一种非常直接的方法。

提前致谢!

Sté*_*nez 70

这就是你想要的:

chmod -R g=u directory
Run Code Online (Sandbox Code Playgroud)

  • 很简单。愉快。 (2认同)