On 24/05/2021 09.22, Marc Chamberlin wrote:
Hello, I am running a number of OpenSuSE systems on my SOHO network at home and I keep hitting a small but annoying problem that I wonder if there is a better workaround/solution to. This occurs on all versions of OpenSuSE - 15.0, 15.1, and 15.2. I am not running 15.3 yet. All systems are x64 architecture.
I want to access the complete file systems of each computer via samba and autofs, which means I want to be able to access the "root" directory / on each system. Some years ago Samba stopped me from designating / as a samba shared directory and exporting it. (I don't understand why except from Googling it appears someone decided that to allow /, to be exported as a Samba share, was a security problem. I get so annoyed at all the layers of security and obfuscation so have not tried to track down what is exactly going on with Samba and the "root" / directory. Please don't try to dissuade me and tell me about the security risks of making the "root" / directory available for mounting, this is a SOHO network and I solely control all the computers on it.) I know Samba will allow me to define a share for the "root" / directory but it doesn't seem to work, at least autofs will not recognize/mount it and still reports the directory does not exist if I try to cd into it. So to work around this I do a bind mount of / as /slash and samba then allows me to export /slash as a samba share.
In my various configuration files I use the name "slash" as the name of the exported Samba share and I create a directory /slash so that my configuration files will work regardless of whether /slash is a bind mount or not. At least that is what I think I am doing.
The config line in fstab looks like this -
/ /slash none bind
smb.conf has the following definitions for the root directory -
[slash] available = Yes browseable = Yes comment = Root directory inherit acls = Yes path = / read only = No create mask = 0755 force user = root
autofs configuration for mounting the root directory / typically looks like the following, only names of the remote host changes.
slash -fstype=cifs,rw,dir_mode=0777,file_mode=0777,credentials=/etc/smb1.auth ://bigbang/slash
This works fine for autofs and most tools that work on the host or across network file systems. All except, that is, the YaST2 partitioner. For some unknown reason it picks up the bind mount /slash and automagically reassigns all my mount points to be under /slash. So for example if I tell it to mount my home partition at /home the partitioner will reassign my mount point to be at /slash/home. More importantly, the partitioner reassigns / to be mounted as /slash. Then if I want to make any further change to partitions and save those changes, the partitioner will complain that the mount point for / is undefined and it wants to force me to define a / mount. The only workaround I have found is to remove the bind mount from fstab and then reboot. After reboot I can then use the YaST partitioner to make the changes I want, since because without the bind mount the partitioner now sees all the mount points of different partitions as subdirectories under / and not under /slash/.
Would just commenting out the "/ /slash none bind" in fstab without rebooting work? The bind mount would remain active, but yast would not know about it. Exit yast, and remove the comment.
But without the bind mount defined in fstab, tools like autofs will no longer mount the "root" / directory though I do not grok why. So again I have to add back in the bind mount to fstab so that Samba shares will again work, and again I have to reboot. I have tried restarting all the appropriate services individually, such as nmb, smb, autofs, and network but no joy getting the the remote host's "root" / dir to remount, so I resort to rebooting the systems (a PITA) and that does the trick...
Perhaps I am missing some magic trick or there is a better way to accomplish what I want to do, which ideally is to configure Samba to really share the "root" / directory. Sorry this is complicated and will be difficult to grok, it is for me! Any help would be much appreciated, I would love to once and for all resolve this irritant because I have to rediscover these issues and their resolutions each time something like autofs breaks or I want to use the partitioner.
Well, there is the question why are you using samba instead of nfs, because you have not mentioned "windows". -- Cheers / Saludos, Carlos E. R. (from 15.2 x86_64 at Telcontar)