Tag Archives: synology

Synology script – set quota for users in an AD group

Quick post, to support some of our VDI efforts we have utilized a Synology NAS to provide home folders for users. It works fairly well, but the Synology utilities are not very granular when it comes to managing multiple users. One distinct issue we ran into was trying to manage the different quotas for specific groups
Below is a simple bash script that takes an Active Directory group as an argument.
When run it sets a disk quota for all the users in that group

Edit the DOMAIN portion and the current “10G” quota to meet your needs

if [ $1 ]

then

for users in $(wbinfo --group-info DOMAIN\\$1 | sed -n -e 's/^.*\://;s/,/\n/gp')

do

if [ "$(synoquota --get $users /dev/vg1000/lv | sed -n 's/\[//;s/\]//;s/^[ \t]*//;s/Quota = //p')" = "0.00 KB" ]

then

synoquota --set $users 1 10G

fi

done

else

echo "USAGE: setquoatas.sh groupname"

fi