I have an application that may or may not run while users are connected to the user's shared account. I would like to reliably determine who the real user is for a kind of ACL "honor system". I think there is some way tracking the parent / group / session process, as the command does pstree, but I'm not sure how to do it better or if there are better alternatives.
I tried it getlogin()initially. This works if used ./myapp, but with the error "cat input |. / Myapp` (because the" control terminal "is a channel belonging to a shared account).
I would rather not trust the environment variables, since I do not want my "honor system" to be completely interrupted simply unsetwhen the information is still available elsewhere.
I would also like to avoid forcing the password database because it is a remote RPC (NIS or LDAP), and I am sure it wtmpalready contains the information I need.
source
share