chmod - replicate user permissions to group/world

折月煮酒 提交于 2019-12-06 16:55:53

find can do the work of finding files with a given permission set and running the smallest possible number of chmod invocations necessary to cover them.

find . \
  '(' -perm -0700 -exec chmod 0777 '{}' + ')' -o \
  '(' -perm -0600 -exec chmod 0666 '{}' + ')'

There is no command that does for you. You do need a little loop:

for file in $(find . -print)
do
  if [ -d $file -o -x $file ]; then
    chmod 777 $file
  else
    chmod 666 $file
  fi
done
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!