Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- directory=$1
- if [ "$directory" == "" ]
- then
- echo -e $"${0##*/}: missing operand"
- exit 1;
- fi;
- if [ $EUID != 0 ]; then
- echo -e $"${0##*/}: cannot fix web permissions on '$directory': Permission denied"
- exit 1;
- fi
- if ! chown -R www-data:www-data $directory
- then
- echo -e $"${0##*/}: changing ownership failed"
- exit;
- fi
- if ! find $directory -type f -exec chmod 644 {} \;
- then
- echo -e $"${0##*/}: Setting file permissions failed"
- exit;
- fi
- if ! find $directory -type d -exec chmod 755 {} \;
- then
- echo -e $"${0##*/}: Setting directory permissions failed"
- exit;
- fi
- echo -e $"${0##*/}: ownership and permissions have been set for web use at \"$directory\""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement