Skip to content

Instantly share code, notes, and snippets.

@trvswgnr
Last active September 25, 2020 03:39
Show Gist options
  • Save trvswgnr/1457eb422603b16cb7e4421326367b2f to your computer and use it in GitHub Desktop.
Save trvswgnr/1457eb422603b16cb7e4421326367b2f to your computer and use it in GitHub Desktop.
Bash - Recursively change permissions to recommended default.
#!/bin/bash
# Check if sudo.
if [ "$EUID" -ne 0 ]
then echo "Please run as root."
exit
fi
# Change permissions of directories and all subdirectories.
find ./ -type d -exec chmod 755 {} \;
# Change permissions of all files recursively.
find ./ -type f -exec chmod 644 {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment