[Samba] Samba dfree command not working

Jeremy Allison jra at samba.org
Mon Sep 11 16:35:01 UTC 2023


On Mon, Sep 11, 2023 at 04:45:51PM +0200, Keram Yasin via samba wrote:
>Dear Samba Team Member,
>
>I installed Samba on my server and It worked perfect so far. Now I wanted
>to use some advanced feature of samba like dfree option. I created a shell
>script named dfree according to the "dfree command (S)" section in the
>following url:
>https://www.samba.org/samba/docs/current/manhtml/smb.conf.5.html
>
>The content of the dfree command is as followings:
>
>STR=$(/usr/sbin/btrfs qgroup show -rF --raw "$1" | /usr/bin/tail -1)
>SIZE=$(/usr/bin/expr `/bin/echo $STR | /usr/bin/cut -d \  -f 4` / 1024)
>USED=$(/usr/bin/expr `/bin/echo $STR | /usr/bin/cut -d \  -f 2` / 1024)
>AVAIL=$(/usr/bin/expr $SIZE - $USED)
>/bin/echo $SIZE $AVAIL
>
>I set the shell script to be owned by nobody user and nobody group. The
>script also has chmod 777 enabled. The script is located at the following
>directory: /var/lib/samba/bin/dfree;
>
>All users' home directory is quota enabled by the btrfs file system. And the
>shell script calculates correctly when executed on the server with the user
>home directory passed as command variable. for example:
>/var/lib/samba/bin/dfree /home/user
>
>First I put the dfree command option to individual share directory such as
>[homes], [users]; After I have saved the changes in /etc/samba/smb.conf
>(the smb.conf file is attached to this email), I restarted samba, then I
>connected to the server from another Windows PC. Then I checked the disk
>size on my Windows PC. The disk size is incorrect. Then, I checked the
>status of the samba with systemctl status smb command. The command output
>shows no error either. For me it seems that the script is not executed by
>Samba with these settings.
>
>Then I put the code in the [global] section. Then connected to the samba
>server from Windows PC again. On the Windows PC, the disk size is incorrect
>as well. Afterwards, I checked the status of samba on linux server with
>this command systemctl status smb. The command output shows as following:
>
>Sep 11 15:42:33 hpstorage systemd[1]: Started Samba SMB Daemon.
>Sep 11 15:42:36 hpstorage smbd[30728]: [2023/09/11 15:42:36.253421,  0]
>../../lib/util/sys_popen.c:111(sys_popenv)
>Sep 11 15:42:36 hpstorage smbd[30728]:   sys_popenv: ERROR executing
>command '/var/lib/samba/bin/dfree': Permission denied

Could this be a selinux or apparmour issue ?

That's the core of your problem.



More information about the samba mailing list