Mount SMB with id shifting

Hi,

I am trying to mount a samba share on a debian 12 (6.1.0-16-amd64) host inside a Ubuntu 22.04 Container.

dpkg -l | grep lxd
ii  lxd                           5.0.2-5                        amd64        Powerful system container and virtual machine manager - daemon
ii  lxd-agent                     5.0.2-5                        amd64        LXD guest agent
ii  lxd-client                    5.0.2-5                        amd64        Powerful system container and virtual machine manager - client

I am following the guides that worked on older versions.

But with id shifting on newer kernels I am a bit lost. When I try to add the mounted smb share, I get the following error.

lxc config device add name lxdshare disk shift=true source=/mnt/path/ path=/mnt/test
Error: Failed to start device "lxdshare": Required idmapping abilities not available

I can add the device without the shift parameter. But then I don’t have write permissions.

Do I have to disable id shifting completely to make it work?

Regards

cifs doesn’t support idmap shifting yet. Your best bet is to instead perform the mount from inside the container using a FUSE version of cifs.

smbnetfs looks like a potential candidate for this.

If you can add a disk device without shift, maybe try setting up idmap for container? For default ubuntu user with UID 1000 and GID 1000 that would be:

printf "uid $(id -u) 1000\ngid $(id -g) 1000" | lxc config set <container_name> raw.idmap -