I'm trying to see if id -r will print out the UID or username of the user who logged into the system despite any su's or sudo's. I'm interested in doing this so I can keep people a little more accountable and to tailor script functioning accordingly (i.e: they issue a sudo on a script and it pulls information from the logged in user's home directory).I realize sudo sets SUDO_USER but I don't want to rely on this because it's a variable that can be modified by the user, and it just has the username of the user who issued the most recent sudo (i.e: sudo -i ; sudo -iu randomUser ; echo $SUDO_USER prints out root instead of the actual user).Nothing in the man pages or that I can find online seems to indicate what the proper use of this command is and the obvious permutations aren't working:[root@ditirlns03 ~]# id -rid: cannot print only names or real IDs in default format[root@ditirlns03 ~]# id -r jadavis6id: cannot print only names or real IDs in default format[root@ditirlns03 ~]# id -r rootid: cannot print only names or real IDs in default formatAt this point, I'm still not sure id -r is going to print out what I want, mostly because I can't figure out how to get it to print out anything at all.
Proper syntax for id -r command
linux;command line;audit
-r must be used in conjunction with another option. For example:$ id -Gr1000 4 24 27 30 46 109 124Quoting the man page:-r, --realprint the real ID instead of  the  effective  ID,  with -ugG