To pass a CIFS/SMB share to an unprivileged LXC container, we will need to configure the mount on the Proxmox host and then pass this through to the LXC container.
The following steps need to be performed on your Proxmox host:
mkdir -p /mnt/medianano /root/.cifs_credentialsAdd the content:
username=your_cifs_username
password=your_cifs_password
Then secure the file by restricting R/W access to root only:
chmod 600 /root/.cifs_credentialsEdit /etc/fstab and configure the share mounted with the uid and gid of the container's root user, which is by default 100000:
//x.x.x.x/media /mnt/media cifs vers=3.0,credentials=/root/.cifs_credentials,uid=100000,gid=100000,nofail,x-systemd.automount 0 0
Note that I also use nofail and x-systemd.automount here since my Proxmox host also runs my TrueNAS instance, so after rebooting the share may not be available on the initial mounting attempt.
Bind the mount into the LXC container like this:
pct set <container_id> -mp0 /mnt/media,mp=/mnt/mediaIf you have multiple mounts you can just use -mp1, -mp2, etc.
That's it! If you now run mount -a this will ensure that the new /etc/fstab configuration takes effect.
Now reboot (or start) your container and it will have access to your newly added mounts. Easy!