rework facl

This commit is contained in:
2018-10-28 01:03:21 +04:00
parent 09b6e906ab
commit 3c2bc4131a

View File

@@ -1,10 +1,8 @@
function myfacl {
function reset_facl {
FUNCTION_PRELUDE
if [[ ( -z $1 ) || ( -z $2 ) ]]; then
echo ':('
return 1
fi
: "${1:?user?}"
: "${2:?dirs?}"
chown -R "${1}:${1}" "${@:2}"
chmod -R u=rwX,g=rwX,o= "${@:2}"
@@ -20,6 +18,20 @@ default:other::0\
" "${@:2}"
}
function add_facl {
FUNCTION_PRELUDE
: "${1:?user?}"
: "${2:?dirs?}"
setfacl -Rm "\
user:${1}:rwX,\
default:user:${1}:rwX,\
group:${1}:rwX,\
default:group:${1}:rwX,\
" "${@:2}"
}
function is_local {
local HOSTNAME="$(hostname)"