The smb.conf(5) manpage suggests using the %S macro to substitute in a username. "If you decide to use a path = line in your [homes] section, it may be useful to use the %S macro. For example: path = /data/pchome/%S</userinput> is useful if you have different home directories for your PCs than for UNIX access." As far as I can tell, these sorts of substitutions are made in alloc_sub_basic() and alloc_sub_advanced() in source3/lib/substitute.c. There was, some years ago, a standard_sub_home() function there which substituted '%S' for the username and '%p' for the user's automount path, but it's no longer there, as far as I can tell. (This section of the documentation hasn't been modified since 2005.) I think that the manpage should reference %U rather than %S; I'll be attaching a patch to this effect. I haven't worked with the Samba source before, so I'm not absolutely certain there's not a good reason to keep it the old way; please let me know if there is.
Created attachment 6040 [details] Patch against current master to fix smb.conf(5) manpage.
Well, but isn't this Samba 3.x related? If yes, I've to reassign it.
I reported it against Samba 4 because It exists in the current master branch, but you make a very good point; those manpages are clearly Samba 3-related. I don't have permission to reassign bugs, so please move this to the appropriate product and section.
Thanks, I will take care on this.
Right, this is samba3-related. The master branch contains both the sources for both samba3 and samba4 as well as shared code. To my understanding, %S (== the name of the service connected to) is appropriate here, since the user connects to a share with name equal to the user's name, so in this special case, %S is the same as the username.
%S works perfectly to match the user name in [homes] as the service name is equal to the user name. This bug is imho invalid