Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 03-02-2016, 07:31 AM   #1
Registered: Dec 2006
Location: Russia,52
Posts: 121

Rep: Reputation: 6
Question How to get all login users?


I need to know if user test in login in.

I created two ssh connections, and in the second one I executed:

# su - test
On the first one I executed:
# who -u
root     tty1         2016-03-02 12:59 02:13        2124
root     pts/0        2016-03-02 13:16   .          8250 (
root     pts/1        2016-03-02 15:23 00:03        5083 (
So, test isn't detected. Is any way to detect if test user login?
Old 03-02-2016, 07:39 AM   #2
LQ Guru
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 6,316

Rep: Reputation: Disabled
su - test is not test user login, it is root switching to test, but still root.
Old 03-02-2016, 07:50 AM   #3
LQ Guru
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,498

Rep: Reputation: 4312Reputation: 4312Reputation: 4312Reputation: 4312Reputation: 4312Reputation: 4312Reputation: 4312Reputation: 4312Reputation: 4312Reputation: 4312Reputation: 4312
based on man su:
       su - change user ID or become superuser

       su [options] [username]

       -, -l, --login
           Provide an environment similar to what the user would expect had the user logged in directly.
based on man who:
       who - show who is logged on

       -u, --users
              list users logged in
su - test will provide an environment, but actually will not log user in. When you execute tty you will see the current terminal and who will show you who was logged in on that terminal - in your case that was root.
Old 03-02-2016, 08:32 AM   #4
LQ Guru
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ Win10
Posts: 9,493

Rep: Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024Reputation: 2024
six ways to find out who is logged in on system
Old 03-02-2016, 08:44 AM   #5
Registered: Jul 2015
Location: Iowa
Distribution: CentOS 6.6, RHEL Server release 5.5 (Tikanga)
Posts: 58

Rep: Reputation: 0
I've always used finger.

After looking at the link BW-userx suggested, I can see it's listed there if you want to read about it
Attached Thumbnails
Click image for larger version

Name:	finger.PNG
Views:	10
Size:	44.4 KB
ID:	21019  

Last edited by JoseKreif; 03-02-2016 at 08:45 AM.


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
CentOS 7 - users unable to login, root can login to GUI triley555 Linux - Newbie 5 02-04-2016 09:33 PM
unable to login any user through the console but users can login in GUI p kumar Linux - Server 1 04-19-2012 07:09 AM
[SOLVED] SSH login problem for additional users after password-less login setup uncle-c Linux - Newbie 3 02-10-2010 01:51 PM
users cant able to login in any console,but root can login. skumar.v Linux - Security 1 04-19-2008 07:57 AM
how to create users they can login through login screen on any network connected comp rohit_67066 Linux - Server 5 02-19-2008 10:53 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:42 AM.

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