helper/shareDirGroup.sh

16 lines
297 B
Bash
Executable file

#!/usr/bin/env bash
if [[ -z "$1" ]] || [[ -z "$2" ]] ; then
echo "usage: $0 user dir [mode]"
exit 1
fi
USER=$1
DIR=$2
MODE=${3:-"rwX"}
if [[ ! -d "$DIR" ]] ; then
echo $DIR not a directory
exit 1
fi
setfacl -m "g:$USER:$MODE" -m "d:g:$USER:$MODE" -m "d:m:$MODE" -m "m:$MODE" -R "$DIR"