[Samba] 3.6.9 samba does not propagate (or show) Linux quota for windows users to see it

Chan Min Wai dcmwai at gmail.com
Tue Sep 30 10:02:31 MDT 2014


Hi Rowland,

This seem to make good docs for samba wiki. 

Thank a lot. 

Regards, 
Chan Min Wai 

> Rowland Penny <rowlandpenny at googlemail.com> 於 30 Sep 2014 11:12 PTG 寫道:
> 
>> On 30/09/14 16:04, Karel Lang AFD wrote:
>> Thanks a lot again Rowland,
>> 
>> Yes, one of my friends says "Windows is user-friendly OS - and Unix too, but Unix is choosing his friends with care" :]]
> 
> Windows is only your friend whilst you have money, Unix will be your friend even if you are penniless ;-)
> 
>> 
>> 
>> Do you think it would be wise to repost the original question to the samba-technical list then?
> 
> It cannot hurt, the script seems to be outputting the require info in the required format, so either your Centos smbd daemon wasn't configured correctly, or you have found a bug, or something else is going on. Either way, hopefully the devs can point you in the right direction.
> 
> Rowland
> 
>> 
>> 
>>> On 09/30/2014 03:52 PM, Rowland Penny wrote:
>>>> On 30/09/14 14:14, Karel Lang AFD wrote:
>>>> Hi Rowland,
>>>> thanks for the hint!
>>>> 
>>>> Mine output is a little different to yours:
>>>> 
>>>> 
>>>> smbd -b | grep 'QUOTA'
>>>>   HAVE_SYS_QUOTA_H
>>>>   HAVE_LINUX_XFS_QUOTAS
>>>>   HAVE_QUOTACTL_LINUX
>>>>   HAVE_SYS_QUOTAS
>>>>   HAVE_XFS_QUOTAS
>>>>   WITH_QUOTAS
>>>>   WITH_QUOTAS
>>>> 
>>>> missing specifically eg. "HAVE_GETQUOTA_RSLT_GETQUOTA_RSLT_U"
>>>> 
>>>> Could this be a problem? This is starting to get to be a bit beyond my
>>>> 'learning curve' i achieved so far at SAmba, i'm afraid ..
>>> 
>>> Hi Karl, don't worry, this is how you learn Unix ;-)
>>> 
>>> I will also learn something here, because I don't know what
>>> 'HAVE_GETQUOTA_RSLT_GETQUOTA_RSLT_U' means either, I think we need one
>>> of the devs to translate it into english from geek speak ;-)
>>> 
>>> Rowland
>>> 
>>>> 
>>>> Karel
>>>> 
>>>> 
>>>> 
>>>> 
>>>>> On 09/30/2014 02:54 PM, Rowland Penny wrote:
>>>>>> On 30/09/14 13:43, Karel Lang AFD wrote:
>>>>>> Thanks Rowland again for much helping out!
>>>>>> 
>>>>>> Your script looks more tidy :].
>>>>>> 
>>>>>> It works nicely and if i run it on unix level, then it reports all the
>>>>>> values in one row to CLI and to log file.
>>>>>> 
>>>>>> But again, when i log in onto windows workstation, and select
>>>>>> 'properties' on my (or anybody) HOME folder then (mapped as H:), again
>>>>>> i get reported the used / free space of whole filesystem and not of
>>>>>> the user quota that is forced upon his home folder :[
>>>>>> 
>>>>>> I have to be missing something or maybe the samba in CentOS is not
>>>>>> compiled with quota support...?
>>>>> 
>>>>> Easy to find out:
>>>>> 
>>>>> smbd -b | grep 'QUOTA'
>>>>> 
>>>>> Should return something like:
>>>>> 
>>>>>   HAVE_SYS_QUOTAS
>>>>>   HAVE_SYS_QUOTA_H
>>>>>   HAVE_RPCSVC_RQUOTA_H
>>>>>   HAVE_GETQUOTA_RSLT_GETQUOTA_RSLT_U
>>>>>   HAVE_NFS_QUOTAS
>>>>>   HAVE_QUOTACTL_LINUX
>>>>>   WITH_QUOTAS
>>>>> 
>>>>> Rowland
>>>>> 
>>>>>> 
>>>>>> Karel
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On 09/30/2014 11:56 AM, Rowland Penny wrote:
>>>>>>>> On 30/09/14 10:33, Karel Lang AFD wrote:
>>>>>>>> Hi Rowland,
>>>>>>>> thanks for excellent suggestion - should have thought of it myself.
>>>>>>>> I redirected the "echo $RET" in my script to file to:
>>>>>>>> /tmp/user.quota.log
>>>>>>>> 
>>>>>>>> Strange thing is, if I right-click on Windows workstation on my
>>>>>>>> "H:\username" homefolder and pick "properties", than the log show
>>>>>>>> exactly 4 empty rows.
>>>>>>>> 
>>>>>>>> Nothing in there, nothing at all, just 4 empty rows
>>>>>>>> 
>>>>>>>> cat user.quota.log | wc -l
>>>>>>>> 4
>>>>>>>> 
>>>>>>>> Not sure if it would tell you - or anybody anything, but i'm out of
>>>>>>>> ideas ..:[
>>>>>>>> 
>>>>>>>> Karel
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>>> On 09/29/2014 08:00 PM, Rowland Penny wrote:
>>>>>>>>>> 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 Lang
>>>>>>>>> 
>>>>>>>>> Hi 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
>>>>>>> Hi Karl, I tried your script and I couldn't get it to output
>>>>>>> anything to
>>>>>>> a temp file until I altered it to this:
>>>>>>> 
>>>>>>> #!/bin/bash
>>>>>>> # /usr/local/bin/query_quota.sh
>>>>>>> 
>>>>>>> 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/sbin/repquota /$DIR | grep -w $IAM | wc -w)
>>>>>>> 
>>>>>>> # over quota
>>>>>>> if [ "$OVER" = "9" ]; then
>>>>>>>     RET=$(/usr/sbin/repquota /$DIR | grep -w $IAM  | awk -F" "
>>>>>>> '{print
>>>>>>> "2 "$3" "$4" "$5" "$7" "$8" "$9}')
>>>>>>> else
>>>>>>>     # not over quota
>>>>>>>     RET=$(/usr/sbin/repquota /$DIR | grep -w $IAM  | awk -F" "
>>>>>>> '{print
>>>>>>> "2 "$3" "$4" "$5" "$6" "$7" "$8}')
>>>>>>> fi
>>>>>>> 
>>>>>>> echo "$RET"
>>>>>>> echo "$RET" > /tmp/results.txt
>>>>>>> 
>>>>>>> exit 0
>>>>>>> 
>>>>>>> I also ran these two commands:
>>>>>>> 
>>>>>>> chmod +r /home/aquota.group
>>>>>>> chmod +r /home/aquota.user
>>>>>>> 
>>>>>>> With the above alterations, I get this in /tmp/results.txt:
>>>>>>> 
>>>>>>> 2 157536380 0 0 134072 0 0
>>>>>>> 
>>>>>>> Which I think is what you require ;-)
>>>>>>> 
>>>>>>> Rowland
> 
> -- 
> To unsubscribe from this list go to the following URL and read the
> instructions:  https://lists.samba.org/mailman/options/samba


More information about the samba mailing list