Re: Wondering if this is a security issue?
"Tim Bradshaw (as tfb at cley dot com)" <[email protected]> Tue, 5 May 2026 11:10:57 +0100
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
On 4 May 2026, at 23:11, David McClain <[email protected]> wrote: > I don’t understand, from your explanations, why it would report “root”. The problem is that logname is one of those utilities which digs into the layers of emulation which allow the OS running, for instance, on a Mac to think it's actually running on a PDP-11. I am pretty sure logname just calls getlogin(3) which returns a pointer to a string containing the name of the user logged in on the controlling terminal of the process, or a null pointer if this information cannot be determined. That depends on at least two things which can be confusing What is the controlling terminal of a process which may well be runnng in a GUI? Is the user logged in on that terminal, whatever it is, in any way related to the user who owns the current process? I have no idea how that Mac GUI gets started but I would not be at all surprised if the 'controlling terminal' is not whatever the OS thinks is its console, in other words whatever is on the end of the topmost RS232 port on the CPU VME card ... no, wait, the whole concept of 'the console' hasn't made sense for forty years now. But if we go back forty years to a machine where there really is a physical terminal on which a user is logged in, then the second question still applies: what, for instance does 'logname; sudo su - otheruser logname' print? The answer should be 'the same string twice', even though the users running the command were different. --tim