0

I'm using rsyslog 8.24 on debian. Each time I trigger logger "some message" the syslog refers to the same and only system user - it does not matter if I switch user (even as root), the messages are always logged as the same user - even on servers - I guess on a desktop, it's because the GUI is running as that user and on a server because I logged in as that user and later switch to root - could that be? But anyway, how could I log a message as root to the syslog?

  • What is the user that logger logs? – Kusalananda Aug 3 '18 at 16:22
  • It's my default system user I use to login to X11 or SSH on servers. – chevallier Aug 3 '18 at 16:26
1

Because logger uses getlogin(3).

https://github.com/karelzak/util-linux/blob/master/misc-utils/logger.c#L379

static char const *xgetlogin(void)
{
    char const *cp;
    struct passwd *pw;

    if (!(cp = getlogin()) || !*cp)
        cp = (pw = getpwuid(geteuid()))? pw->pw_name : "<someone>";
    return cp;
}

Which returns "name of the user logged in on the controlling terminal of the process". i.e. your system user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.