ZFS (NFS) dataset shared inside of unprivileged LXC/VM

escher

New Member
Oct 5, 2020
5
0
1
41
Hi guys,
I'm trying to configure a share in my unprivileged container with id mapping.

In host (Proxmox 6.2):
- created user ctuser (1003:1003 in host)
- both /etc/subuid, /etc/subgid look like this:
Code:
        root:100000:65536
        ctuser:362144:65536
        root:1003:1
- in /etc/pve/lxc/[CTID].conf:
Code:
        mp0: /tank/share,mp=/shared
        ...
        lxc.idmap: u 0 100000 1003
        lxc.idmap: g 0 100000 1003
        lxc.idmap: u 1003 1003 1
        lxc.idmap: g 1003 1003 1
        lxc.idmap: u 1004 101004 64532
        lxc.idmap: g 1004 101004 64532
- ls -la /tank/ returns:
drwxr-xr-x 7 ctuser ctuser 9 Oct 5 16:29 share

lxc container starts ok, /shared gets automatically mounted

In lxc container:
- login as root (0:0 in lxc)
- I can create new file /shared/test.txt and ls -la returns
-rw-r--r-- 1 root root 5 Oct 5 14:29 test.txt
- in host the file looks like
-rw-r--r-- 1 100000 100000 5 Oct 5 16:29 test.txt

Shouldn't it rather be like this?
-rw-r--r-- 1 ctuser ctuser 5 Oct 5 16:29 test.txt

Am I doing something wrong or is this expected?
Is there a better way to do it?

Any help/confirmation would be great.
 

oguz

Proxmox Staff Member
Staff member
Nov 19, 2018
2,814
316
88
hi,

In host (Proxmox 6.2):
- created user ctuser (1003:1003 in host)
- both /etc/subuid, /etc/subgid look like this:
you need to have an equivalent user in the CT with that uid/gid

try in /etc/subuid and /etc/subgid to put just: root:1003:1 , restart the container
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE 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 your own in 60 seconds.

Buy now!