LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 09-30-2009, 07:31 AM   #1
hiarunn
LQ Newbie
 
Registered: Apr 2006
Posts: 7

Rep: Reputation: 0
How to track the user sessions


I'm using LDAP and kerberos for user authentication. All I want to know is how to track the users currently logged on from a common location. I was thinking of having a script to write the $USER,$HOSTNAME,login/logout time, hours used etc on a NFS mount, but don't know where to call the script so that it will be executed whenever an user logs in / logs out. I'm using Gnome desktop manager.

Thanks in advance.

--
Arun
 
Old 09-30-2009, 08:54 PM   #2
half_life1052
LQ Newbie
 
Registered: Jul 2008
Posts: 1

Rep: Reputation: 0
If you want to track who is logged in to your machine, just use the "w" command. To keep it updating you would use a command such as "watch -n2 w". This will show who is logged in, and what they are doing. It will update every 2 seconds "-n2" . To find out historically who has logged in, the "last" command will help you.
 
Old 10-01-2009, 12:00 AM   #3
hiarunn
LQ Newbie
 
Registered: Apr 2006
Posts: 7

Original Poster
Rep: Reputation: 0
The command "w" or "last" is useful when you want to know who is currently logged into a particular system. But in my setup there are 250+ workstations. I should be able to see who logged into to each system. The output of the script/cmd should be something like below

Host User Login_time logout_time
------------------------------------
host1 userA 10:30 Still logged in
host2 userB 09.15 12:10
host3 userX 11.30 Still logged in

This should get updated everytime a user login/logout.
 
Old 10-07-2009, 08:02 AM   #4
hiarunn
LQ Newbie
 
Registered: Apr 2006
Posts: 7

Original Poster
Rep: Reputation: 0
I found the way to do this. I wrote a simple shell script to log the hostname, user name and login/logout time to a plain text file and append the lines to /etc/X11/gdm/PostLogin/Default file to log when a user logs in and /etc/X11/gdm/PostSession/Default can be used when a user quits the session. The information can be directed to a text file on the network mount or to a remote database.
 
Old 12-02-2009, 12:07 AM   #5
bharatlalgupta
Member
 
Registered: Aug 2008
Posts: 80
Blog Entries: 1

Rep: Reputation: 16
Question i want to know ur linux script

hello hiarunn
can u tell me ur linux shell script for me ..........


Thanks
 
  


Reply

Tags
login, logout, script



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
How to get a Bash to count user sessions without WC Bamahut Programming 5 07-16-2008 06:52 AM
record of user sessions PirateJack Linux - Newbie 5 04-03-2006 02:25 PM
how to track all the live sessions in php? xudingding Linux - Software 3 02-15-2006 10:55 AM
track sudo user mikeshn Linux - General 2 10-28-2003 07:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 03:21 PM.

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