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 05-12-2009, 07:44 AM   #1
neel_learning_linux
LQ Newbie
 
Registered: May 2008
Posts: 13

Rep: Reputation: 0
Number of current sessions for user


Hi!

when I run "su <username>" as root, a new session is created. If wanted to know how many such sessions currently exists for a particular user (active or inactive), how do I find that out?

Thanks in advance,
-Neel.
 
Old 05-12-2009, 09:30 AM   #2
dandart
Member
 
Registered: Dec 2005
Posts: 34

Rep: Reputation: 18
use "who".
 
Old 05-13-2009, 06:54 AM   #3
neel_learning_linux
LQ Newbie
 
Registered: May 2008
Posts: 13

Original Poster
Rep: Reputation: 0
I found that "who" gives the users that have logged in to terminal. Even if "su <username>" succeeds in changing the owner of the session/effective uid, that does not affect output of "who".

To rephrase the original question, what I want is the way to find out how many sessions exist with effective uid of given user.

Do let me know if I am missing something.

Thanks again,
-Neel.
 
Old 05-13-2009, 08:39 AM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 11,380
Blog Entries: 3

Rep: Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478Reputation: 1478
Hi,

You can use 'users' from the cli which will give you the user name then perform on that.

Quote:
excerpt from 'man users';

users - print the user names of users currently logged in to the cur-
rent host

SYNOPSIS
users [OPTION]... [ FILE ]

DESCRIPTION
Output who is currently logged in according to FILE. If FILE is not
specified, use /var/run/utmp. /var/log/wtmp as FILE is common.

--help display this help and exit

--version
output version information and exit
 
Old 05-13-2009, 09:40 AM   #5
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: /root
Distribution: Slackware & BSD
Posts: 1,220

Rep: Reputation: 231Reputation: 231Reputation: 231
neel_learning_linux:

this post is already two days and nobody is able to "decipher or decode" your cryptic question

please ask your question clearly and you shall be attended to properly
 
Old 05-13-2009, 04:14 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,000
Blog Entries: 11

Rep: Reputation: 892Reputation: 892Reputation: 892Reputation: 892Reputation: 892Reputation: 892Reputation: 892
Quote:
Originally Posted by neel_learning_linux View Post
I found that "who" gives the users that have logged in to terminal. Even if "su <username>" succeeds in changing the owner of the session/effective uid, that does not affect output of "who".

To rephrase the original question, what I want is the way to find out how many sessions exist with effective uid of given user.

Do let me know if I am missing something.

Thanks again,
-Neel.
I hope I understand corectly what you mean by a "session"
in this context

Code:
ps -eo euid,command|grep bash|grep -v grep | sort|uniq -c

Cheers,
Tink
 
  


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
linux C syscall to get number of columns of current terminal? reishin Programming 4 07-15-2009 02:59 AM
how to convert address in current process to filename:line number telia Linux - General 5 01-12-2009 05:06 AM
How do increase the number of PTS sessions allowed? I am currently limited to 34. kazman1969 Linux - Newbie 3 06-24-2008 07:29 PM
Gnome: Auto mounting external devices as first user logged in, not current user yitzle Linux - Software 4 04-01-2008 10:43 AM
record of user sessions PirateJack Linux - Newbie 5 04-03-2006 03:25 PM


All times are GMT -5. The time now is 05:45 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration