[SOLVED] NFS share from OMV mount on unprivileged container drives me crazy

remars

New Member
May 20, 2024
2
0
1
Hello the Proxmox community,

I'm writing you requesting some help on the issue I encountered trying to mount a NFS share deployed from my OMV NAS.
I saw several tutorials for CIFS/SMB, but nothing entirely conclusive for NFS :

https://forum.proxmox.com/threads/tutorial-mounting-nfs-share-to-an-unprivileged-lxc.138506/
https://forum.proxmox.com/threads/tutorial-unprivileged-lxcs-mount-cifs-shares.101795/
https://forum.proxmox.com/threads/cifs-or-nfs-mount-inside-unprivleged-container.58655/
https://www.youtube.com/watch?v=aEzo_u6SJsk&t=233s
https://www.youtube.com/watch?v=DMPetY4mX-c

Just as an introduction, the setup is currently like this on OMV :
Client: *
Options: async,no_subtree_check,insecure,no_root_squash

With that option, I correctly mounted the share on the PVE with FSTAB setup, and I can read/write in it with root user.
172.16.0.3:/export/nas/ /mnt/nas nfs defaults 0 0

I mount the share from PVE to LXC with the setup of the mount in /etc/pve/lxc/300.conf :
mp0: /mnt/nas/,mp=/mnt/nas
From now, everything is fine regarding that, but on the LXC I can only read with all users in the folder unfortunately (Permission denied for writing).

From the links above, I found the technic of adding lxc_shares group with the id 10000 and add my users to it.
It is supposedly mapped to the GID=110000 on the PVE host but I couldn't find this group via cat /etc/group, so it is for sure aint going to work !

I just passed my entire afternoon on this issue trying to fin why the permission is denied for writing on this nfs share... Just to let you know that I also tried the all_squash parameter on the NFS share (https://manpages.debian.org/bookworm/nfs-kernel-server/exports.5.en.html#all_squash) and add the group id/gid as well, without succes (all_squash,anonuid=101001,anongid=101001)

For sure, PVE is understanding the no_root_squash setting as it is not succeeding writing on the share without it and with root... I do not know why the all_squash parameter is not working by the way.

I would like to higly thank you in advance for reading this post and trying to help me !
 

Attachments

  • LXC nas r.JPG
    LXC nas r.JPG
    62.1 KB · Views: 8
  • OMV No root squash.JPG
    OMV No root squash.JPG
    77.9 KB · Views: 8
  • PVE nas rw.JPG
    PVE nas rw.JPG
    68.9 KB · Views: 6
Last edited:
Ok, I succeed to manage the mounted folder by creating a dummy user in PVE "remars-lxc" and by assigning it the uid and group id 101000 (with a group carriying the id). Like this, the user is mapped with my user in the lxc. Changing the owner of the mounted file to this new dummy user make the trick !

Good explaination here :
https://www.youtube.com/watch?v=QT-WW4iczZ0&t=1458s

Cheers
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!