systemd-journal 그룹에 사용자를 추가하려고 할 때 사용자가 존재합니다.

systemd-journal 그룹에 사용자를 추가하려고 할 때 사용자가 존재합니다.

나는 systemd-journal을 실행/사용하여 읽고 싶었습니다 journalctl -b. 이제 사용자로 실행하면 다음과 같은 결과가 나타납니다.

$ 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.

그런 다음 /etc/group에서 grep을 실행하여 그러한 그룹이 존재하는지 확인했습니다.

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

그런 다음 사용자를 그룹에 추가하려고 합니다.

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

당신은 그것이 말하는 것을 볼 수 있습니다.

id 명령을 사용하여 shirish가 속한 그룹을 찾습니다.

$ 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)

보시다시피 저는 systemd-journal의 회원이 되고 싶지 않습니다.

답변1

useradd그룹에 사용자를 추가하는 데 을(를) 사용하고 있지 않습니다 . 사용자를 생성 하는 데 사용되었으므로 useradd오류 메시지가 나타납니다. 노력하다:

# usermod -a -G systemd-journal shirish

또는

# gpasswd -a shirish systemd-journal

두 경우 모두 다시 로그인해야 적용됩니다. 실행 중인 셸에서 이 작업을 수행하는 빠르고 더러운 방법은 다음과 같습니다.

$ exec su - shirish

답변2

명령 이름이 혼란스럽습니다. 당신이 원하는adduser바꾸다useradd:

adduser shirish systemd-journal

adduser명령은 모든 Linux 버전에서 작동하지 않을 수 있지만 debian에서는 사용할 수 있습니다.

관련 정보