Karel Lang AFD
2014-Sep-29 14:03 UTC
[Samba] 3.6.9 samba does not propagate (or show) Linux quota for windows users to see it
Hi list, perhaps someone can help me out? fact: - samba 3.6.9 plus CentOS 6.5 - i have user quotas set up on their HOME directories, which resides in the "/home" filesystem - on windows workstation their disk quota is not shown, instead they see whole filesystem free/taken space (which generate much grumbling) After searching lists, googling etc., i decided to give a try the "smb.conf" option: "get quota command" and written a script to back it up. so i have got in "smb.conf": get quota command = /usr/local/bin/query_quota.sh Script (based on the script that was written by Rick Brown back in 2005 that i dug out of samba list): ************************************************************************ #!/bin/bash PATH=/usr/bin:/usr/sbin:/bin IAM=`id -un` # find the user's home file system. DIR="home" #check and see if they're over quota, as it will affect output # user with reached quota has 9 fields in row, 'ok' user only 8 OVER=`/usr/bin/sudo /usr/sbin/repquota /$DIR | grep -w $IAM | wc -w` # over quota if [ $OVER -eq 9 ]; then RET=`/usr/bin/sudo /usr/sbin/repquota /$DIR | grep -w $IAM | awk -F" " '{print "2 "$3" "$4" "$5" "$7" "$8" "$9}'` else # not over quota RET=`/usr/bin/sudo /usr/sbin/repquota /$DIR | grep -w $IAM | awk -F" " '{print "2 "$3" "$4" "$5" "$6" "$7" "$8}'` fi echo $RET ************************************************************************ script output if run by user on linux: 2 2494580 3300000 3500000 3444 0 0 Which should be about right - according to the Manpage of smb.conf that says: "This script should print one line as output with spaces between the arguments. The arguments are: ? Arg 1 - quota flags (0 = no quotas, 1 = quotas enabled, 2 = quotas enabled and enforced) ? Arg 2 - number of currently used blocks ? Arg 3 - the softlimit number of blocks ? Arg 4 - the hardlimit number of blocks ? Arg 5 - currently used number of inodes ? Arg 6 - the softlimit number of inodes ? Arg 7 - the hardlimit number of inodes ? Arg 8(optional) - the number of bytes in a block(default is 1024) But still i see only report of free / used space on the whole Filesystem, that i mapped to windows as H:\username Anybody could share some insight on this matter? Thanks a LOT. Karel Lang
Rowland Penny
2014-Sep-29 18:00 UTC
[Samba] 3.6.9 samba does not propagate (or show) Linux quota for windows users to see it
On 29/09/14 15:03, Karel Lang AFD wrote:> > Hi list, > perhaps someone can help me out? > > fact: > - samba 3.6.9 plus CentOS 6.5 > > - i have user quotas set up on their HOME directories, which resides > in the "/home" filesystem > > - on windows workstation their disk quota is not shown, instead they > see whole filesystem free/taken space (which generate much grumbling) > > > After searching lists, googling etc., i decided to give a try the > "smb.conf" option: > "get quota command" and written a script to back it up. > > so i have got in "smb.conf": > get quota command = /usr/local/bin/query_quota.sh > > > Script (based on the script that was written by Rick Brown back in > 2005 that i dug out of samba list): > ************************************************************************ > #!/bin/bash > PATH=/usr/bin:/usr/sbin:/bin > > IAM=`id -un` > > # find the user's home file system. > DIR="home" > > #check and see if they're over quota, as it will affect output > # user with reached quota has 9 fields in row, 'ok' user only 8 > OVER=`/usr/bin/sudo /usr/sbin/repquota /$DIR | grep -w $IAM | wc -w` > > # over quota > if [ $OVER -eq 9 ]; then > RET=`/usr/bin/sudo /usr/sbin/repquota /$DIR | grep -w $IAM | > awk -F" " '{print "2 "$3" "$4" "$5" "$7" "$8" "$9}'` > else > # not over quota > RET=`/usr/bin/sudo /usr/sbin/repquota /$DIR | grep -w $IAM | > awk -F" " '{print "2 "$3" "$4" "$5" "$6" "$7" "$8}'` > fi > echo $RET > ************************************************************************ > > script output if run by user on linux: > 2 2494580 3300000 3500000 3444 0 0 > > > Which should be about right - according to the Manpage of smb.conf > that says: > > "This script should print one line as output with spaces between the > arguments. > The arguments are: > > ? Arg 1 - quota flags (0 = no quotas, 1 = quotas enabled, > 2 = quotas enabled and > enforced) > > ? Arg 2 - number of currently used blocks > > ? Arg 3 - the softlimit number of blocks > > ? Arg 4 - the hardlimit number of blocks > > ? Arg 5 - currently used number of inodes > > ? Arg 6 - the softlimit number of inodes > > ? Arg 7 - the hardlimit number of inodes > > ? Arg 8(optional) - the number of bytes in a > block(default is 1024) > > > But still i see only report of free / used space on the whole > Filesystem, that i mapped to windows as H:\username > > Anybody could share some insight on this matter? > > Thanks a LOT. > > Karel LangHi Karl, have you tried altering the script to dump $RET to a file in /tmp, this will show you just what the script is actually producing in use. Rowland