NFS Share from a Synology NAS in an Unprivileged LXC Container

initB10r

Member
Jan 9, 2023
17
0
6
Hello everyone,

After my QNAP NAS failed, I recently switched to a Synology NAS and now I’m facing an issue where I need your help.

I’ve set up a test share on my Synology NAS as follows:

1738056409480.png

I mounted this share on my Proxmox host like this:

1738056452789.png

On the Proxmox host, I can access the share at /mnt/pve/NAS_A without any issues. I can create, modify files and directories, and use chown to freely change the owner and group.

However, when I start an unprivileged LXC container with the following configuration, I’m unable to access the directory /share/DockerNew:
Code:
arch: amd64
cores: 1
features: keyctl=1,nesting=1
hostname: test
memory: 512
mp0: /mnt/pve/NAS_A,mp=/share/DockerNew
net0: name=eth0,bridge=vmbr0,firewall=1,hwaddr=BC:24:11:E7:85:48,ip=dhcp,type=veth
ostype: debian
rootfs: Data:subvol-107-disk-0,size=8G
swap: 512
unprivileged: 1
lxc.idmap: u 0 100000 1000
lxc.idmap: g 0 100000 1000
lxc.idmap: u 1000 1000 1
lxc.idmap: g 1000 1000 1
lxc.idmap: u 1001 101001 64535
lxc.idmap: g 1001 101001 64535

Running ls -l on /share inside the LXC container gives me:
Code:
root@test:/share# ls -l 
total 0 
drwxrwxrwx 1 schneckenDocker schneckenDocker 114 Jan 27 14:45 DockerNew 
root@test:/share# cd DockerNew/ 
-bash: cd: DockerNew/: Permission denied

On the Proxmox host, the output is:
Code:
root@schneckenProxmox:~# ls -l /mnt/pve/ 
drwxrwxrwx 1 schneckenDocker schneckenDocker 114 Jan 27 15:45 NAS_A 

root@schneckenProxmox:~# cd /mnt/pve/NAS_A 
root@schneckenProxmox:/mnt/pve/NAS_A# ls -l 
total 4 
drwxrwxrwx 1 schneckenDocker schneckenDocker 0 Jan 27 15:04 images 
-rw-r--r-- 1 schneckenDocker schneckenDocker 0 Jan 27 15:32 NfsA_1000 
-rw-r--r-- 1 schneckenDocker schneckenDocker 2 Jan 27 15:45 NfsA_100000 
-rw-r--r-- 1 schneckenDocker schneckenDocker 0 Jan 27 15:32 NfsA_root 
drwxrwxrwx 1 schneckenDocker schneckenDocker 0 Jan 27 15:04 snippets 
-rwxrwxrwx 1 schneckenDocker schneckenDocker 0 Jan 27 15:45 winA.txt

The user schneckenDocker (ID 1000) exists on the Synology NAS, the Proxmox host, and inside the LXC container. Despite this, I receive a Permission denied error when trying to access the directory in the container.

Does anyone know why I cannot access the share within the LXC container? I never had this issue with my previous QNAP NAS.

Thank you so much for your support!

Best regards,
Marc
 
If there haven't been any changes lxc with nfs access only works with privileged conainers.


My Synology nfs mount looks like this:
1738065045322.png

Also with unprivileged lxc you can neither activate nfs nor smb:
1738065219459.png

So if you want nfs in lxc you need to make a priviliged one.
 
Thank you for your reply! However, I can’t understand this, as my original LXC container with a Docker installation was able to access an NFS share from QNAP without any issues.

Here are the settings from the QNAP:

1738091924202.png

It must be possible to make this work with the NFS from Synology as well.

Does anyone have any ideas?