LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-09-2014, 10:31 PM   #1
mathewhai
LQ Newbie
 
Registered: Feb 2013
Posts: 4

Rep: Reputation: Disabled
Identify all users logged in to the system even with su command


My requirement is to know all users who are active in the system.

But generally I login to my machine as root and then do "su" to my user.

"who" command will return all users logged in to the system, but not the user who is logged in with su command.


Please help me here, the best way to identify all users logged in to the system, who is even logged in with an su command.

Thanks in advance.
 
Old 07-10-2014, 07:39 AM   #2
netnix99
Member
 
Registered: Jun 2011
Distribution: redhat, CentOS, OpenBSD
Posts: 298

Rep: Reputation: 99
'who' registers the logged in user; therefore, it will list your login as root. The 'su' command simply gives you the ability to pose as another user;therefore, you are not actually logged in to the computer as that user, and you will not show up in the 'who' or 'last' (wtemp) as that user.

Best Business Practices will stipulate that you are logging in incorrectly. You "SHOULD" log in as a regular user and 'su to root' only when needed. This helps mitigate incidents where unrecoverable (or at least PAINFUL) modifications are made by unintentionaly using root to access to the system or files.

I'm not trying to tell you what to do, just stating the BBP's for security....

HTH
 
1 members found this post helpful.
Old 07-11-2014, 08:33 AM   #3
mathewhai
LQ Newbie
 
Registered: Feb 2013
Posts: 4

Original Poster
Rep: Reputation: Disabled
To make it simple, I login with my username and su to a systemmaint user by entering password. How to find this active user?
 
Old 07-11-2014, 09:19 AM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
this user is logged in remotely as root via su -
Code:
[schneidz@hyper ~]$ w
 10:18:11 up 23:21,  6 users,  load average: 0.89, 0.97, 0.88
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
schneidz tty4                      10:14    2:31   0.20s  0.28s login -- schneidz     
schneidz tty1     :0               Thu10   23:20m 15:46   0.42s pam: gdm-password
schneidz pts/0    :0.0             Thu11    4:36   0.06s  0.06s bash
schneidz pts/1    :0.0             Thu11    5.00s  1.03s  0.13s ssh xbmc
schneidz pts/2    :0.0             Thu11    0.00s  0.23s  0.07s w
schneidz pts/3    xbmc             10:16    5.00s  0.20s  0.44s sshd: schneidz [priv]
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Listing of last logged in users (last command) rpascua Linux - Newbie 4 03-21-2014 01:31 AM
Bash command to list users logged in at 5pm F4U57 Linux - Newbie 2 06-07-2010 10:37 PM
How to keep system resources free and identify suspicious/offending users and scripts m2azer Linux - Newbie 3 12-16-2008 09:34 AM
List users logged in to remote system jantman Linux - Software 3 12-11-2006 12:01 AM
UNIX command to identify a system's IP address blackreality Linux - Software 6 06-18-2003 02:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration