LinuxQuestions.org
Review your favorite Linux distribution.
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 03-02-2016, 06:31 AM   #1
sluge
Member
 
Registered: Dec 2006
Location: Russia,52
Posts: 116

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


Hello,

I need to know if user test in login in.

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

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

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

Rep: Reputation: 2814Reputation: 2814Reputation: 2814Reputation: 2814Reputation: 2814Reputation: 2814Reputation: 2814Reputation: 2814Reputation: 2814Reputation: 2814Reputation: 2814
based on man su:
Code:
NAME
       su - change user ID or become superuser

SYNOPSIS
       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:
Code:
NAME
       who - show who is logged on

       -u, --users
              list users logged in
conclusion:
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, 07:32 AM   #4
BW-userx
Senior Member
 
Registered: Sep 2013
Location: MID-SOUTH USA
Distribution: Void Linux / Slackware 14.2
Posts: 4,690

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

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:	9
Size:	44.4 KB
ID:	21019  

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


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

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

All times are GMT -5. The time now is 07:38 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration