2

Well i use SUSE11, Linux machine.

when logged to a Linux machine as root user,

sne-91:~ # pwd

/root

and then i log in to a particular user using "su - " cmd.

sne-91:~ # su - sunil

<1000 sne-91 [sunil] :/home/sunil>echo $USER

sunil

then "who" cmd does n't display "userName" and it shows "root" instead of "userName"

<1000 sne-91 [sunil] :/home/sunil>who

root pts/0 2014-09-18 11:56 (10.18.164.138)

Can anyone help in finding alternate cmd to find the users logged into particular machine..? Thanks

Sunil Kumar
  • 367
  • 2
  • 5
  • 19

1 Answers1

2

With su - you do not log in as a new user, you just substitute your account for this shell. As far as the OS is concerned, there is no change about who logged in on which port.

You might use the whoami command to see what user you currently impersonate.

jlliagre
  • 29,783
  • 6
  • 61
  • 72
  • 1
    so there is no way to monitor which all users are currently using machine.? because my senario is like this, i need to monitor a directory for any new file creation by any user, if new file is created then i check the owner of the file and send a message to the "port" of the user.. when its logged from root and if i send message to "port" of root then it gets displayed to all users logged in from root which is wrong. – Sunil Kumar Sep 18 '14 at 07:48