Why is 'logger' always executed as the same user?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
0
down vote

favorite












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?







share|improve this question



















  • What is the user that logger logs?
    – Kusalananda
    Aug 3 at 16:22










  • It's my default system user I use to login to X11 or SSH on servers.
    – chevallier
    Aug 3 at 16:26

















up vote
0
down vote

favorite












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?







share|improve this question



















  • What is the user that logger logs?
    – Kusalananda
    Aug 3 at 16:22










  • It's my default system user I use to login to X11 or SSH on servers.
    – chevallier
    Aug 3 at 16:26













up vote
0
down vote

favorite









up vote
0
down vote

favorite











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?







share|improve this question











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?









share|improve this question










share|improve this question




share|improve this question









asked Aug 3 at 15:57









chevallier

800116




800116











  • What is the user that logger logs?
    – Kusalananda
    Aug 3 at 16:22










  • It's my default system user I use to login to X11 or SSH on servers.
    – chevallier
    Aug 3 at 16:26

















  • What is the user that logger logs?
    – Kusalananda
    Aug 3 at 16:22










  • It's my default system user I use to login to X11 or SSH on servers.
    – chevallier
    Aug 3 at 16:26
















What is the user that logger logs?
– Kusalananda
Aug 3 at 16:22




What is the user that logger logs?
– Kusalananda
Aug 3 at 16:22












It's my default system user I use to login to X11 or SSH on servers.
– chevallier
Aug 3 at 16:26





It's my default system user I use to login to X11 or SSH on servers.
– chevallier
Aug 3 at 16:26











1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










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


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






share|improve this answer





















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f460368%2fwhy-is-logger-always-executed-as-the-same-user%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










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


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






    share|improve this answer

























      up vote
      1
      down vote



      accepted










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


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






      share|improve this answer























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






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


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






        share|improve this answer













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


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







        share|improve this answer













        share|improve this answer



        share|improve this answer











        answered Aug 3 at 16:30









        steve

        11.9k22047




        11.9k22047






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f460368%2fwhy-is-logger-always-executed-as-the-same-user%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay