Review your favorite Linux distribution.
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 11-17-2011, 08:18 PM   #1
LQ Newbie
Registered: Nov 2011
Posts: 6

Rep: Reputation: Disabled
Script Help -- documenting specific users that log into server

Hello All,

I am trying trying to write a shell script that will do a couple things:

1.) Identify any username that logs into the server.

2.) When the user logs out, send them an email detailing
their log in/out times, duration logged in, and what
processes they ran.

Basically, I need help with which commands I should employ and how to send the emails. Any advice is much appreciated. Thanks!!
Old 11-17-2011, 10:04 PM   #2
Registered: Apr 2009
Location: Melbourne
Distribution: Fedora & CentOS
Posts: 854

Rep: Reputation: 191Reputation: 191
I would suggest looking at "who", "w", and "last" to provide you with the information, in conjunction with some grep/awk/sed'ing. To extract the relevant parts (although, the output of these commands may be sufficient to email in and of itself)

Then look at sendmail to do the sending of the mail.
Old 11-17-2011, 11:28 PM   #3
Registered: Nov 2011
Posts: 42

Rep: Reputation: Disabled
Sendmail is a good command line tool for sending e-mails.


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
Documenting a DNS Caching Server? morphix Linux - Server 1 03-03-2009 07:02 PM
Shell script to grep log for a specific error sfcg Programming 8 06-28-2008 10:12 AM
script to log users in zerocool22 Linux - Server 3 05-13-2008 02:59 AM
Bash script for server log (namely var/log/messages) tenaciousbob Programming 17 05-24-2007 11:43 AM
Allow only specific IP's to log to FTP server ganninu Linux - Security 5 12-11-2003 08:26 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:39 PM.

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