User dependent selective sharing of partitions between Linuxes

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
MatNieuw
Level 1
Level 1
Posts: 45
Joined: Sun Mar 11, 2018 4:45 pm

User dependent selective sharing of partitions between Linuxes

Post by MatNieuw »

Hi,

on a multiboot 5-Linux system, people in a specified group should be able to have separate data partition mounts, and have it SMB-shared with the network.
E.g. developers may mount and share source, normal users common data, guests none of these.

I think to get it SMB shared, the proper way is to mount it via fstab, so the share path is stable and can be specified in smb.conf. If it was auto-mounted below /media , its path would depend on the user being logged in.

To enable group-only access, I wanted to use the fstab mount option group,noexec,rw,gid=nnnn . ext4 and btrfs don't support gid=, so I use jfs, which does support it (even if not seen in "man mount"); regretfully, jfs is not ssd-aware. This seems to work, sharing when booting between Mint 17.3 and 18.3 works fine when using the same groupid on both.
When logging in as guest, and the "other" rights of /mnt/data set to all 0, /ls /mnt/data will show that there is a data directory. Alas, it will show whatever is in the root of this data directory such as file names and directory name, even though it cannot access them.

So I'm partly there. Is there a better way of doing this? Can automount be set to have a fixed path and conditional mounting (depending on group id, for instance)?

Thanks, Mat
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: User dependent selective sharing of partitions between Linuxes

Post by catweazel »

MatNieuw wrote: Sun Sep 30, 2018 4:33 pm on a multiboot 5-Linux system, people in a specified group should be able to have separate data partition mounts, and have it SMB-shared with the network.
I have no idea what "a multiboot 5-Linux system" is supposed to be, nevertheless I think you've taken a wrong turn by expecting or hoping for this to be done in fstab. What you need is a startup script that identifies the parameters you've described then mounts the shares in the way you want them mounted.

If this were my system I'd use NFS rather than SMB. As for the startup script, I'd make it a systemd service. While that post was written for Mint 19, it should still work on your other systems.
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
MatNieuw
Level 1
Level 1
Posts: 45
Joined: Sun Mar 11, 2018 4:45 pm

Re: User dependent selective sharing of partitions between Linuxes

Post by MatNieuw »

Hi,

thanks for the reply. I'll explain the multi-boot. I am building a system to test/try software on different Linuxes, directly on the hardware. For this, I use 3 partitions for LTS Mints (17.3 , 18.3, 19), plus one partition for AV-Linux, and one for any other Linux I want to test with (e.g. TinyCore, next Mint releases) which I'll overwrite each time.
Any non-hardware related testing I'll do in a VirtualBox VM.

I am much a fan of systemd, not in the least because of the journal. I'll check out your script.

Mat
MatNieuw
Level 1
Level 1
Posts: 45
Joined: Sun Mar 11, 2018 4:45 pm

Re: User dependent selective sharing of partitions between Linuxes

Post by MatNieuw »

Hi,

I looked at systemd scripting, and it looks like I can do what I want on systemd using the RequiresMountsFor option. However, as this is a test system and I also want to be able to test with initd systems, this would require me to make and maintain two different scripts, plus both systemd and init scripts will not be obvious.

So for now, I've settled on a JFS filesystem for a common partition which allows setting the groupid with an fstab entry:
UUID=xxx /mnt/Common jfs defaults,noexec,nodev,gid=1003 0 1

This works fine for both read and write between 4 different Linuxes. It is also immediately obvious as the fstab file needs editing anyway.
Locked

Return to “Installation & Boot”