Fix script-files-permissions-set
This commit is contained in:
@@ -7,13 +7,10 @@
|
|||||||
is_root
|
is_root
|
||||||
|
|
||||||
if [[ $# -eq 0 ]]; then
|
if [[ $# -eq 0 ]]; then
|
||||||
|
echo "No arguments provided, using autodetection"
|
||||||
|
paths=("$PWD")
|
||||||
user=$(stat -c "%U" "$PWD")
|
user=$(stat -c "%U" "$PWD")
|
||||||
group=$(stat -c "%G" "$PWD")
|
group=$(stat -c "%G" "$PWD")
|
||||||
echo "No arguments provided, using autodetection"
|
|
||||||
if [[ "$group" != "smbgrp" ]]; then
|
|
||||||
echo "This file will not be world-accessible by the smbgrp group"
|
|
||||||
ask_ok "Change group $group to smbgrp?" && group="smbgrp"
|
|
||||||
fi
|
|
||||||
elif [[ $# -eq 1 ]]; then
|
elif [[ $# -eq 1 ]]; then
|
||||||
user="$1"
|
user="$1"
|
||||||
group="$1"
|
group="$1"
|
||||||
@@ -32,7 +29,15 @@ for path in "${paths[@]}"; do
|
|||||||
if [[ "$path" == "/" ]]; then
|
if [[ "$path" == "/" ]]; then
|
||||||
echo "You are trying to operate on the root partition!"
|
echo "You are trying to operate on the root partition!"
|
||||||
echo "This seems highly unusual!"
|
echo "This seems highly unusual!"
|
||||||
! ask_ok "Continue?" && exit $?
|
ask_ok "Continue?" || exit $?
|
||||||
|
fi
|
||||||
|
og_user=$(stat -c "%U" "$path")
|
||||||
|
og_group=$(stat -c "%G" "$path")
|
||||||
|
echo -e "PATH\tUSER\tGROUP"
|
||||||
|
echo -e "$path\t$og_user\t$og_group"
|
||||||
|
if [[ "$group" != "smbgrp" || "$og_group" != "smbgrp" ]]; then
|
||||||
|
echo "$path is not world-accessible by the smbgrp group"
|
||||||
|
ask_ok "Change $path group $og_group to smbgrp?" && group="smbgrp"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user