Last active
April 15, 2021 09:05
-
-
Save zkelo/d33e66dea6ba185e1cd399540ace4218 to your computer and use it in GitHub Desktop.
Выставление правильных ACL-прав
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
#!/usr/bin/env bash | |
if [ ! -n "$1" ]; | |
then | |
echo Вы должны ввести путь к папке; | |
exit 1; | |
fi; | |
folder=$(readlink -f $1); | |
shift; | |
if [ ! -n "$1" ]; | |
then | |
echo Вы должны ввести псевдоним хотя бы одного пользователя; | |
exit 1; | |
fi | |
echo Папка: $folder; | |
read -p "Вы действительно хотите продолжить? " -n 1 -r; | |
echo; | |
if [[ $REPLY =~ ^[YyДд]$ ]]; | |
then | |
chmod g+s $folder; | |
for user in $@; | |
do | |
setfacl -Rm u:$user:rwX $folder; | |
setfacl -dRm u:$user:rwX $folder; | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment