Ulrich Sibiller
2025-Jul-07 15:30 UTC
[Samba] Dynamic share configuration at connection time?
Hello, tl/dr: Is it possible to have a script that this run when a client connects to a share which determines and sets the config of that share on the fly? Longer version: We have setup a system where we share _many_ dirs. Currently there are two types of dirs that require different samba configurations. In our DFS we have links like this (backslashes replaced by slashes for convenience): share1 -> msdfs:<server>/<filesystem_normal>/share1 share2 -> msdfs:<server>/<filesystem_normal>/share2 share3 -> msdfs:<server>/<filesystem_special>/share3 The "trick" is that <filesystem_special> is pointing to the same filesystem as <filesystem_normal> but has a differing configuration in smb.conf. So all we have to do is take care of the correct links in DFS. The <filesystem_normal> links are generated automatically via a script that sets up the DFS. The <filesystem_special> links have to be manually maintained in a config file. I would like to spare the manual maintenance of the config file and instead have a script that runs when a client connects to <server>/<filesystem>. This script should determine the correct configuration and apply it on the fly for that share (or connection) only. (Note that the determination cannot be done by the DFS generation script as it has limited access to the required information.) Is this possible somehow? Note that this is just our special case but might be handy in other situations, too. So a generic solution (or extension, if there's no solution with the current code) might be of general use. MfG/Kind regards, Ulrich Sibiller -- Dipl.-Inf. Ulrich Sibiller Senior IT Consultant T: +49 (0) 7071 9457 681 (Hotline) Hagellocher Weg 73?? 72070 T?bingen?? Germany eviden.com Eviden Germany GmbH; Gesch?ftsf?hrung: Christian Peter Ernst, Boris Hecker; Vorsitzender des Aufsichtsrates: Paul Peterson; Sitz der Gesellschaft: M?nchen; Registergericht: Amtsgericht M?nchen, HRB 281696
Ulrich Sibiller
2025-Jul-15 11:10 UTC
[Samba] Dynamic share configuration at connection time?
Ulrich Sibiller via samba schrieb am 07.07.2025 17:30:> Hello, > > tl/dr: Is it possible to have a script that this run when a client > connects to a share which determines and sets the config of that share on > the fly?...> I would like to spare the manual maintenance of the config file and > instead have a script that runs when a client connects to > <server>/<filesystem>. This script should determine the correct > configuration and apply it on the fly for that share (or connection) only. > (Note that the determination cannot be done by the DFS generation script > as it has limited access to the required information.)Unfortunately no-one has reacted so far. I am thinking about writing an own VFS module for this but I am unsure if that is possible at all via a VFS module. Does anybody know? Thanks, Ulrich Sibiller -- Dipl.-Inf. Ulrich Sibiller Senior IT Consultant T: +49 (0) 7071 9457 681 (Hotline) Hagellocher Weg 73?? 72070 T?bingen?? Germany eviden.com Eviden Germany GmbH; Gesch?ftsf?hrung: Christian Peter Ernst, Boris Hecker; Vorsitzender des Aufsichtsrates: Paul Peterson; Sitz der Gesellschaft: M?nchen; Registergericht: Amtsgericht M?nchen, HRB 281696