how to change mount user on unprivilege container.

wfamy

Active Member
Sep 9, 2019
5
0
41
52
Hi all:
I use proxmox 6 under debian 10 using zfs filesytem
I have a mail server and i want to mount a directory from host into the guest
after install my directory looks like

ls -lhn
drwx------ 5 2000 2000 5 juil. 26 23:11 vmail1
drwx------ 2 0 0 2 juil. 5 19:14 vmail2

I want to use vmail2 for my mail
I add the following ligne in the configuration
mp0: /tankdur/fichiers/deb10mail,mp=/var/vmail/vmail2

when restart my rep looks like:

drwx------ 5 2000 2000 5 juil. 26 23:11 vmail1
drwxr-xr-x 9 65534 65534 9 juil. 5 15:50 vmail2

or

drwx------ 5 vmail vmail 5 juil. 26 23:11 vmail1
drwxr-xr-x 9 nobody nogroup 9 juil. 5 15:50 vmail2

I saw i have to mapped my user https://pve.proxmox.com/wiki/Unprivileged_LXC_containers

cat /etc/subuid
vmail:100000:65536

cat /etc/subgid
vmail:100000:65536

I try lot of combinaison in my /etc/pve/lxc/num.conf but i do not manage to "map" the id.
I may miss something but i don't know where.

So How to have my vmail2 owned by user vmail ?
Thanks for your help.
 
hi,

you don't need to create a custom uid map (users in unprivileged containers are already mapped with the rule 0 -> 100000), you can just set the owner of the file on your host to the default mapped id.

so to fix the nobody:nogroup you can just run on your host: chown -R 100000:100000 /var/vmail/vmail2. inside your container you will see it belongs to root. if you want it to belong to another user, change 100000 with the respective value (for example www-data would be 100033 since the uid is normally 33)

hope this helps

https://pve.proxmox.com/wiki/Linux_Container#_bind_mount_points
 

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!