Lxd deamon user group issue

root@Irtaza-Hussain:~# lxd --version
5.21.2 LTS

root@Irtaza-Hussain:~# hostnamectl
Static hostname: Irtaza-Hussain
Icon name: computer-container
Chassis: container ☐
Machine ID: xyz
Boot ID: xyz
Virtualization: wsl
Operating System: Ubuntu 24.04.1 LTS
Kernel: Linux 5.15.167.4-microsoft-standard-WSL2
Architecture: x86-64
root@Irtaza-Hussain:~#

root@Irtaza-Hussain:~# id foo
uid=1001(foo) gid=1001(foo) groups=100(users),1001(foo)
root@Irtaza-Hussain:~# id bar
uid=1002(bar) gid=1002(bar) groups=1002(bar)
root@Irtaza-Hussain:~# ls -lh /var/snap/lxd/common/lxd-user/unix.socket
srw-rw---- 1 root lxd 0 Dec 18 17:50 /var/snap/lxd/common/lxd-user/unix.socket
root@Irtaza-Hussain:~# ls -lh /var/snap/lxd/common/lxd/unix.socket
srw-rw---- 1 root lxd 0 Dec 18 17:50 /var/snap/lxd/common/lxd/unix.socket
root@Irtaza-Hussain:~# su foo
foo@Irtaza-Hussain:/root$ lxc list
Error: LXD unix socket “/var/snap/lxd/common/lxd/unix.socket” not accessible: permission denied
foo@Irtaza-Hussain:/root$ su bar
Password:
su: Authentication failure
foo@Irtaza-Hussain:/root$ 12345
12345: command not found
foo@Irtaza-Hussain:/root$ su bar
Password:
bar@Irtaza-Hussain:/root$ lxc list
Error: LXD unix socket “/var/snap/lxd/common/lxd/unix.socket” not accessible: permission denied

Please help me!

To use the multi-user daemon, you need to tell the LXD snap which group to use:

sudo snap set lxd daemon.user.group=<user_group>

You can find more information here: https://documentation.ubuntu.com/lxd/en/latest/howto/projects_confine/#confine-users-to-specific-lxd-projects-via-unix-socket

4 Likes