Last active
December 15, 2015 04:50
-
-
Save Gisleburt/5204512 to your computer and use it in GitHub Desktop.
Many Linux problems are caused by messed up permissions. This fixes that shit (sort of).
This file contains 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 | |
# This bit is by Brian Campbell | |
# Source: http://stackoverflow.com/questions/699576/validating-parameters-to-a-bash-script | |
die () { | |
echo >&2 "$@" | |
exit 1 | |
} | |
[ "$#" -eq 1 ] || die "This shit takes one arguement user[:group]" | |
# This bit is mine | |
# http://www.danielmason.com | |
sudo echo "Fixing this shit" && \ | |
sudo echo "Fixing ownership" && \ | |
sudo chown -R $1 . && \ | |
sudo echo "Fixing permissions" && \ | |
sudo chmod -R o-rwx . && \ | |
sudo chmod -R ug+rwX . && \ | |
sudo echo "This shit is fixed" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment