First, my apologies. It’s been a busy couple of weeks. I didn’t intend on leaving you hanging!
A moment of truth: I stopped using LXC for my Plex configuration about a year ago and went with Docker. However, I did have this mapped and working from LXC so I’ve recreated this configuration for the purposes of this response. In doing so, I discovered that the important step I didn’t mention earlier is that the container be created in “privileged” access, not unprivileged. There is likely a method to get unprivileged working, but it was either specific to UIDs or added a lot of steps or both.
For the sake of openness, here is my configuration:
Proxmox: latest version (currently 5.3-12)
LXC: Using the Debian 9.7 template, privileged
From the LXC template in /etc/pve/lxc (101.conf in my case)
mp0: /home/kelinger/Omni/mnt/Google,mp=/Google
Basically, on the host, I have my Google mounted with rclone mount commands to /home/kelinger/Omni/mnt/GoogleCrypt and then remount it with MergerFS and some local directories to /home/kelinger/Omni/mnt/Google. Thus, I’m passing that read-write directory from the host to /Google inside the LXC.
On the host, ls -l /home/kelinger/Omni/mnt/Google:
drwxr-xr-x 6 kelinger kelinger 6 Apr 8 15:28 Downloads/
drwxrwxr-x 2 kelinger kelinger 2 Apr 10 11:15 Media/
Once in the LXC (from the host, pct enter 101
)
ls -l /Google:
drwxr-xr-x 6 1000 1000 6 Apr 8 22:28 Downloads
drwxrwxr-x 2 1000 1000 2 Apr 10 18:15 Media
Now, inside the LXC (as root as I haven’t done anything beyond create the LXC and connect to it at this point), I type touch /Google/testfile
And my directory now looks like:
drwxr-xr-x 6 1000 1000 6 Apr 8 22:28 Downloads
drwxrwxr-x 2 1000 1000 2 Apr 10 18:15 Media
-rw-r--r-- 1 root root 0 Apr 10 19:37 testfile
Whereas on the host, it looks like:
drwxr-xr-x 6 kelinger kelinger 6 Apr 8 15:28 Downloads/
drwxrwxr-x 2 kelinger kelinger 2 Apr 10 11:15 Media/
-rw-r--r-- 1 root root 0 Apr 10 12:37 testfile
So basically, in privileged mode, it’s mapping the LXC’s UIDs and GIDs to those on the host. I don’t have a user/group 1000 yet, but if I create one (adduser lxcuser
from within the LXC) my directory listing magically turns into:
drwxr-xr-x 6 lxcuser lxcuser 6 Apr 8 22:28 Downloads
drwxrwxr-x 2 lxcuser lxcuser 2 Apr 10 18:15 Media
-rw-r--r-- 1 root root 0 Apr 10 19:37 testfile
(this is assuming that the user created has UID and GID 1000; you can create the group ahead of time and use parameters to force adduser to use 1000/1000 if those are available, which they should be on a fresh LXC).
A quick test of rm testfile
shows that I can also delete files from the mount within the LXC.
Are you able to replicate the process above on your system successfully?