Forum archive
Turnkey Linux File Server SMB - No Guest Access possible OOB
I was experimenting with running TKL FileServer as NAS in a lxc container for Proxmox, and I was unable to log in as a guest from either mac os or windows until I manually edited the smb.conf as follows:
#restrict anonymous = 2 map to guest = Bad User
The first line exists must be commented out by hand. The second I added by hand to the [global] section. I could not find any webmin option related to either of these in the GUI.
I am not a SMB wizard by any means, but something seems weird here. Commenting out the "restrict anonymous" was necessary, even though the Samba documentation clearly states that "guest ok = yes" (or its synonym "public = yes") in the [share] section should override it. But in my experience, it did not do so.
Similarly I don't like having to use "map to guest = Bad User" as it maps any failed logins to guest, but it seems to be necessary.
Can anyone shed any light on this? Is this a bug? Or a security "feature" of a newer SMB protocol? Should webmin and/or TKL be updated?
It looks to me that the "restrict anonymous = 2" parameter is in the smb.conf for TKL/Common on github, so this issue could affect TKL Media Server and other prebuilt tools.
Welcome to TurnKey and thanks for posting your issue. If nothing else, I'm sure that it will be useful for others.
We're mostly all full time Linux users here at TurnKey and I personally don't have any need for Samba, thus no significant experience with it. Having said that, I have been quite involved in maintaining it and I do fire up a Win10 VM for basic testing when we do a new major release, or when bug fixing. Judging from your post, my guess is that you are much more of a "SMB wizard" than I am! ;)
Regardless, my initial perusal of the smb.conf Debian Bullseye man page (which is relevant to TKL v17.x - equivalent for v16.x is likely the same, but can be explicitly viewed here) is consistent with yours. I.e. to support guest login, you only need to need to set 'guest ok = yes' (no need to comment out "restrict anonymous = 2") - bold is mine:
And
But after a bit more digging and a re-read, I suspect that despite the alluded implication that setting 'guest ok = yes' (or 'public = yes') completely nullifies "restrict anonymous = 2", that it actually doesn't. I think the literal intention of the doc is to note that it just nullifies the security advantage provided (but doesn't fully disable it):
I.e. note that neither references actually say that 'guest ok = yes' completely disables 'restrict anonymous = 2', just that it negates the security benefits.
FWIW, I searched fairly wide and far to try to get a handle on this issue. The only bug report I found that seemed relevant (reported in 2014, status "new", no response), suggests to me that the issue is a documentation one rather than a functionality one.
If you want to dig into that some more, then I encourage you to sign up to and post a message on, the Samba mailing list (I suggest the default, general Samba list). If we can confirm the intention, perhaps it's even worth proposing a draft improvement for the man page? Maybe what's there just needs an explicit note that whilst 'guest ok = yes' disables the security provided by 'restrict anonymous = 2', it isn't enough to allow guest access?
Also, apparently (noted in the bug report I linked to above), setting 'restrict anonymous = 1' will allow guest login, but not 'restrict anonymous = 2'. I haven't tested or confirmed that, but thought it worth a mention...
Re "map to guest = Bad User" - yes my reading of the docs is that that is necessary to allow guest access. As you likely read, it says something about this being required because of the order of operations when authenticating and allowing access to resources.
Finally, regarding Webmin. After having a bit of a poke around there, I found reference to "guest access". It looks like it's configured at the share level rather than globally. Although I'm not 100% clear whether that would be enough or not to make it work (following your post, I suspect not). Please check the Webmin Samba module docs for more info.
We package the default upstream Webmin samba module currently, but if there are improvements to be made then we could provide a patch to the Webmin devs to improve it? Or even if we didn't go that way, we could patch it ourselves? Either way, with the amount I have on my plate at the moment it's highly unlikely that I'll have time and space for anything like that anytime soon. If you know any perl, then perhaps you could have a go yourself?