On 05/29/2017 12:17 PM, fred roller wrote:
> On 05/27/2017 10:12 PM, fred roller wrote:
>> you could run "who" to see if the root user is still logged
on as well.
>
> I have a terminal open, logged in as root with su -. When I
ran who, it
> just showed me, logged in once and no root. Checking with
uptime, it
> shows one user.
I never heard of 'who' ;-) Unfortunately, it is true: I ran
'su -' and then who in another tab and in a different terminal
emulator and it showed no root nor me as root, just me.
True, you will see the multiple instances of your log-in and their
"terminal". "tty" for your graphics and "pts" for terminal
emulators.
Open multiple tabs in your cli emulator and run who and you will what I
am talking about. Running sudo invokes root privileges for your user,
hence, no root user just your user. You would have to set root pw and
actually log-in with root to see the root log in. I apologies for the
ambiguity.
"who" shows you who is currently logged in (based on data from
/var/run/utmp or /var/log/wtmp). Since the other "su -" sessions were
spawned from the initial user's shell, "who" only shows that initial
login user since that's the only user who actually logged in and has
data in utmp or wtmp. Remember that "su -" or "sudo -i" do NOT
actually
perform logins--they fork a process and run the shell in that process
handing it flags that make it ACT like a login shell.
If you do a "ps flax" and track things, you'll see that the bash
sessions with the UID of root all have parent processes that are "su -"
programs, which were in turn run by the initial logged-in user. You'll
also find their process names are "-bash" and not "bash".
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, AllDigital ricks(a)alldigital.com -
- AIM/Skype: therps2 ICQ: 226437340 Yahoo: origrps2 -
- -
- We look for things. Things that make us go! -
- -- The "Paclyds", Star Trek TNG -
----------------------------------------------------------------------