Skip to content

Instantly share code, notes, and snippets.

@f4bio
Last active October 12, 2022 01:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save f4bio/a231708cc95cadd1672770a526cf8a55 to your computer and use it in GitHub Desktop.
Save f4bio/a231708cc95cadd1672770a526cf8a55 to your computer and use it in GitHub Desktop.
fix linux file/folder permissions
#!/bin/sh
findCmd=${FIND_EXECUTABLE_PATH:-$(which find)}
targetGroup=${TARGET_GROUP_NAME:-$(id -ng)}
targetUser=${TARGET_USER_NAME:-$(id -nu)}
$findCmd $1 -type f -exec chmod 664 {} \;
$findCmd $1 -type d -exec chmod 775 {} \;
$findCmd $1 -exec chown $targetUser:$targetGroup {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment