Mount an SMB share and use iGPU on an unprivileged Debian 12 LXC container in Proxmox
Procedure
Section titled “Procedure”Prerequisites:
Create an unprivileged Debian 12 LXC container.
Inside the LXC container, use the root user to create a non-root user. In this example the user is added to the sudo and docker groups after installing Docker inside the LXC container.
useradd -s /bin/bash -m -G sudo,docker ismaelChange the user password as needed.
su ismaelpasswdThis user’s default UID:GID will be 1000:1000. If not, create it with:
useradd ismael -u 1000 -g 1000 -m -s /bin/bash -G sudo,dockerTake note of this UID:GID as it will be used to map the share in Proxmox. The share itself can live on another system; here an unRAID VM on the same host is used.
SMB share
Section titled “SMB share”On the Proxmox host
Section titled “On the Proxmox host”Create a user that can be mapped from the host to the LXC container. Without this step, the share ends up read-only inside the LXC container.
Proxmox maps the users and groups from the host to the LXC containers starting at UID:GID=100000:100000.
The created ismael user then:
- Inside the LXC container UID: 1000
- Inside the host UID: 101000
Create a group on the host with GID=101000 that will own the directory created for the SMB share
groupadd -g 101000 ismaelCreate the same user that will be used inside the LXC container but with the right UID:GID combination
useradd ismael -u 101000 -g 101000 -m -s /bin/bashMake a directory for the share
mkdir /mnt/mediaChange the directory’s owner to the previously created user
chown ismael:ismael /mnt/mediaModify the /etc/fstab file to mount the SMB share on the directory we created
nano /etc/fstabCopy this line inside the nano editor for /etc/fstab (note the guest part, as this SMB share has no password set)
//192.168.0.10/media /mnt/media cifs guest,rw,uid=1000,gid=1000,file_mode=0777,dir_mode=0777 0 0For shares that require a password:
//192.168.0.10/media /mnt/media cifs username=<username>,password=<password>,rw,uid=1000,gid=1000,file_mode=0777,dir_mode=0777 0 0Reload the changes to /etc/fstab before mounting
systemctl daemon-reloadmount -aCreate a mountpoint in your LXC container pointing to the created share directory
pct set 104 -mp0 /mnt/media,mp=/mnt/user/mediaStart the LXC container and the share is mounted in /mnt/user/media, writable by the mapped user.
Coming soon…