Adding user to a group

Hello everyone,

i am new to silverblue and just trying to find my way around. Initially, I found my way around quite quickly but now i got stuck trying to add my user to a the docker group. Docker is up and running and its group shows up in /usr/lib/group.

I tried several approaches, but apparently it is not possible to edit /etc/group directly.

I tried the troubleshooting pages, but they seem to be a bit dated. To my understanding, silverblue is using systemd-sysusers.service now.

I really would appreciate help / guidance.

Thanks,
Sebastian

1 Like

Hi @devbeer, this should help you out. :slight_smile:

Managing Users and Groups

@miker256 Thanks for the link. I had a look at this already. However, I am still unsure what I need to do or How this differs from the 2nd line I linked:

# grep -E '^libvirt:' /usr/lib/group >> /etc/group
# usermod -aG libvirt username

To be precise, the first line does not work, because I do not have permission to edit group - that is where my question considering systemd comes from.
The second line does not throw an error, but has also no effect.

Are you issuing the commands as root?

Would be good to see the error you get.

Ah thanks, a lot. I did a stupid mistake by doing sudo grep -E '^libvirt:' /usr/lib/group >> /etc/group and somehow did not get that this only runs the first part of the command as superuser. Therefore, I got a permission denied error. When running the command from a root shell, all worked fine.

1 Like

To avoid a root shell, I like to use this construct:

$ grep -E '^libvirt:' /usr/lib/group | sudo tee -a /etc/group

described here:
https://www.cyberciti.biz/faq/sudo-append-data-text-to-file-on-linux-unix-macos/

1 Like