Debian – user exists when trying to add user to systemd-journal group

debiangroupmate-desktoppermissionsusers

I have been wanting to read systemd-journal by running/using journalctl -b . Now if I run it as a user I get the following :-

$ journalctl -b
Hint: You are currently not seeing messages from other users and the system
      Users in the 'systemd-journal' group can see all messages. Pass -q to
      turn off this notice.
No journal files were opened due to insufficient permissions.

After this I ran a grep in /etc/group to see if such a group exists.

$ sudo grep systemd-journal /etc/group
systemd-journal:x:102:
systemd-journal-remote:x:128:

then I tried to add the user to that group :-

$ sudo useradd -G systemd-journal shirish
useradd: user 'shirish' already exists

You can see what it says.

I used the id command to find which groups shirish belongs to

$ id shirish
uid=1000(shirish) gid=1000(shirish) groups=1000(shirish),24(cdrom),25(floppy),29(audio),30(dip),44(video),46(plugdev),108(netdev),110(lpadmin),113(scanner),119(bluetooth),131(kvm),132(libvirt)

As can be seen I do not shirish being member of systemd-journal.

Best Answer

You don't use useradd to add a user to a group. You use useradd to create a user, hence the error message. Try:

# usermod -a -G systemd-journal shirish

or

# gpasswd -a shirish systemd-journal

In either case, you need to log in again to make it take effect. A quick-and-dirty way of doing this in a running shell is:

$ exec su - shirish
Related Question