Share & Mount - I need your help

jolanda7150

Dabbler
Joined
Sep 16, 2022
Messages
14
Hello,
I do have a hard time figuring out how I should share/mount in my use case. Please help me figuring out a reliable way.
On my desktop I simply share as SMB and mount with cifs uid+gid to my user. Works fine, all good.

Now I need a reliable way for my servers. Typically two shares will be mounted to each server/vm: app and backup.
The application writes some runtime data and config to *app* and backups will be saved on *backup*.
I'm using TrueNAS Core and all the clients are linux servers.
On TrueNAS I've configured a user *appname* which has access to *app* and *backup*.

My main questions are:
- Should I use SMB/CIFS or NFS?
- How should I mount it so that client's user *appname* has access to it?


The SMB approach I use for my workstation does not work here, since the client user will have an unknown uid+gid. For sure I can manually find that out, but it will not be consistent across installs. And since I automate everything, another way would be preferably.
One thing I thought I can do is to create a group on the client, put the appuser in that group and mount the share with this gid. Will this result in full rw access to the mount?

So I thought I will try NFS and shared the two directories (NFSv4 enabled, NFSv3 ownership model enabled, port 111 and 2049 opened).
For the shares I've set mapall user/group to *appname* (which is a user/group on both TrueNAS and the client)

On the client I mounted:
- 10.0.0.100:/mnt/tank/apps/myapp to /mnt/myapp
- 10.0.0.100:/mnt/tank/backups/myapp to /mnt/myapp-backup

those mounts appear like so:
Code:
d---------@ - root root 22 Okt 14:57  myapp/
drwxr-xr-x  - root root 22 Okt 14:54  myapp-backups/


- my appuser can write to the first mount, but not to the second.
- They are both configured in exactly the same way... why the difference?!
- Why do the permissions on the first directory look like this? For file they look even weirder: .---------@ 0 1006 root

So tl/dr: I didn't have success with either SMB nor NFS.
 

ChrisRJ

Wizard
Joined
Oct 23, 2020
Messages
1,919
You can create users and groups with specific IDs. Since those IDs are the actual values anyway, I would certainly specify them as part of the automation.
 

jolanda7150

Dabbler
Joined
Sep 16, 2022
Messages
14
That is not an option here. I am not in control of which uid/gid the service user will receive.
 

ChrisRJ

Wizard
Joined
Oct 23, 2020
Messages
1,919
Interesting. Just out of curiosity, can you elaborate on the background?
 

jolanda7150

Dabbler
Joined
Sep 16, 2022
Messages
14
wow... I just realized that its possible to provide username + group as uid + gid, instead of the numbers...
This works for me just fine.
 
Top