Newgrp lxd asking for password

After installing lxd (with: sudo apt install lxd), I’m being asked for a password when I want to add the current user to the “lxd group” with: newgrp lxd

I tried the root and the user’s password without success.

My fresh Ubuntu 20.04 already had entries in: /etc/group and /etc/gshadow. I removed the lxd entry in both files. Strange that there are already entries for “lxd” without having lxd installed, yet.

Then I followed this guide:

Problem solved.


When you install LXD, the LXD server starts working just fine.
The default client, which is the lxc command, needs to have access to the server.
The LXD installation creates a group called lxd, and then creates a Unix socket for the administration of LXD. And that Unix socket can only be administered by users who belong to the lxd group.

Therefore, when you install LXD,

  1. you can either run all lxc commands with sudo (such as, sudo lxc list)
  2. you can add your non-root user account to the lxd group do that you have access to that Unix socket for LXD administration.

The LXD installer may not know which account should be the LXD administrator, therefore it is up to you to add the account to the LXD group. You can do that with

 sudo adduser dsmx lxd

Then, you need to log out and log in again so that the new session will be made aware of the new group membership.

The newgrp command does not create a new group; what it does, it saves you the log out and login again. That is, if you want to use LXD straight away, you can run newgrp lxd and this will start for you a new shell that has the lxd membership. Obviously, when you reboot your computer (or logout/login), you do not need to run newgrp lxd anymore. Your new sessions will be fully aware of your lxd Unix group membership.

1 Like