Last active
September 25, 2020 03:39
-
-
Save trvswgnr/1457eb422603b16cb7e4421326367b2f to your computer and use it in GitHub Desktop.
Bash - Recursively change permissions to recommended default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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