Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- [ "`id -u`" != 0 ] && echo "Must be root to run this script" && exit -1
- [ -z "$2" -o "$3" ] && echo "Usage: $0 user directory" && exit -1
- USER="$1"
- DIR="$2"
- id "$USER" >& /dev/null || {
- echo "User '$USER' not exist";
- exit -1;
- }
- [ ! -d "$DIR" ] && echo "Directory '$DIR' not exist" && exit -1
- sudo -u "$USER" test -d "${DIR}/."
- if [ "$?" != 0 ]; then
- echo "FAILED: $USER -> $DIR"
- exit 1
- else
- echo "OK: $USER -> $DIR"
- exit 0
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement