Prerequisites

  • a working SMB share

Mount SMB-Share to Proxmox host

  1. Create a folder for the mount
    • I usually create a folder named after the remote host (that hosts the share) and in it a folder with the share name
    • eg. /mnt/truenas/photos
    • mkdir -p /mnt/truenas/photos
  2. add the mount for the folder to /etc/fstab
    • Edit fstab (with nano /etc/fstab)
    • I usually use the following mount configuration:
    • //truenas/photos/ /mnt/truenas/photos cifs _netdev,x-systemd.automount,noatime,uid=101000,gid=101000,dir_mode=0770,file_mode=0770,user=<username>,pass=<password> 0 0
    • Make sure to replace the path and username and password with your own.
    • the mount is created as the user 101000:101000 with file and folder permissions 770
    • for more information see https://wiki.archlinux.org/title/Fstab
  3. reload the daemon `systemctl daemon-reload
  4. Mount the Share
    • mount /mnt/truenas/photos
    • or to mount all mounts mount -a

Bind the mount in the LXC

  1. Add a bind mount for the LXC
    • open the LXC config at /etc/pve/lxc/<LXC_ID>.conf
      • nano /etc/pve/lxc/<LXC_ID>.conf
    • mount the folder
      • mp0: /mnt/truenas/photos,mp=/mnt/truenas/photos
      • The first path is the path on the host
      • The path after mp= is the path in the LXC
      • This example mounts the share in the container on the same location as on the host
  2. restart the LXC

The mount is mounted as 101000 on the host, so it is owned by 1000 in the container.

Sources: https://forum.proxmox.com/threads/tutorial-unprivileged-lxcs-mount-cifs-shares.101795/