Unix Technical Forum

login log time in seconds

This is a discussion on login log time in seconds within the AIX Operating System forums, part of the Unix Operating Systems category; --> Dears , I have been put into a difficult situation by one of my security advisors... whic is that ...


Go Back   Unix Technical Forum > Unix Operating Systems > AIX Operating System

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-04-2008, 08:47 PM
sasa queer
 
Posts: n/a
Default login log time in seconds

Dears ,
I have been put into a difficult situation by one of my security
advisors...
whic is that if any one of the user login into the system and logout
within
same minute ( i.e if he logout from system in 45 seconds ) the last
command
could not be able to display the duration of user's session properly
as " last"
command shows ( 23:42-23:42) i.e in hh:mm format.
Now two questions:
1.Is there any way to get the duration of session in seconds?

2.I know how to get the login time in seconds ( lsuser or
/etc/security/lastlog file) but does any body conceive any way to
record the logout time in same way?

SASA
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-04-2008, 08:49 PM
sasa queer
 
Posts: n/a
Default Re: login log time in seconds

Dears,
Does aybody have some ideas in their minds to solve this problem.

SASA

sasa1973pk@yahoo.com (sasa queer) wrote in message news:<702930ee.0311092108.2532b953@posting.google. com>...
> Dears ,
> I have been put into a difficult situation by one of my security
> advisors...
> whic is that if any one of the user login into the system and logout
> within
> same minute ( i.e if he logout from system in 45 seconds ) the last
> command
> could not be able to display the duration of user's session properly
> as " last"
> command shows ( 23:42-23:42) i.e in hh:mm format.
> Now two questions:
> 1.Is there any way to get the duration of session in seconds?
>
> 2.I know how to get the login time in seconds ( lsuser or
> /etc/security/lastlog file) but does any body conceive any way to
> record the logout time in same way?
>
> SASA

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-04-2008, 08:50 PM
Steve Greatbanks
 
Posts: n/a
Default Re: login log time in seconds

Perhaps look at auditing login and logout events and parsing the audit logs?

"sasa queer" <sasa1973pk@yahoo.com> wrote in message
news:702930ee.0311112059.50bff090@posting.google.c om...
> Dears,
> Does aybody have some ideas in their minds to solve this problem.
>
> SASA
>
> sasa1973pk@yahoo.com (sasa queer) wrote in message

news:<702930ee.0311092108.2532b953@posting.google. com>...
> > Dears ,
> > I have been put into a difficult situation by one of my security
> > advisors...
> > whic is that if any one of the user login into the system and logout
> > within
> > same minute ( i.e if he logout from system in 45 seconds ) the last
> > command
> > could not be able to display the duration of user's session properly
> > as " last"
> > command shows ( 23:42-23:42) i.e in hh:mm format.
> > Now two questions:
> > 1.Is there any way to get the duration of session in seconds?
> >
> > 2.I know how to get the login time in seconds ( lsuser or
> > /etc/security/lastlog file) but does any body conceive any way to
> > record the logout time in same way?
> >
> > SASA



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-04-2008, 08:51 PM
sasa queer
 
Posts: n/a
Default Re: login log time in seconds

Thanks for suggestion!
But the auditing logs once again give the time in same manner ( hh:mm)
I have an idea to write a C program which should be executed in
background
whenever the user logs into the system.
This program will gets the tty device they login on and counts the
seconds until the user logs off the tty.
can anybody help me writing this idea in C or simple shell as i am not
a
C programmer.
I will really appreciate anyhelp in this regard
SASA

"Steve Greatbanks" <steve_greatbanks@hotmail.com> wrote in message news:<bosre5$1us2$1@otis.netspace.net.au>...
> Perhaps look at auditing login and logout events and parsing the audit logs?
>
> "sasa queer" <sasa1973pk@yahoo.com> wrote in message
> news:702930ee.0311112059.50bff090@posting.google.c om...
> > Dears,
> > Does aybody have some ideas in their minds to solve this problem.
> >
> > SASA
> >
> > sasa1973pk@yahoo.com (sasa queer) wrote in message

> news:<702930ee.0311092108.2532b953@posting.google. com>...
> > > Dears ,
> > > I have been put into a difficult situation by one of my security
> > > advisors...
> > > whic is that if any one of the user login into the system and logout
> > > within
> > > same minute ( i.e if he logout from system in 45 seconds ) the last
> > > command
> > > could not be able to display the duration of user's session properly
> > > as " last"
> > > command shows ( 23:42-23:42) i.e in hh:mm format.
> > > Now two questions:
> > > 1.Is there any way to get the duration of session in seconds?
> > >
> > > 2.I know how to get the login time in seconds ( lsuser or
> > > /etc/security/lastlog file) but does any body conceive any way to
> > > record the logout time in same way?
> > >
> > > SASA

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-04-2008, 08:51 PM
Mike
 
Posts: n/a
Default Re: login log time in seconds

In article <702930ee.0311132018.effc5e5@posting.google.com> , sasa queer wrote:
> Thanks for suggestion!
> But the auditing logs once again give the time in same manner ( hh:mm)
> I have an idea to write a C program which should be executed in
> background
> whenever the user logs into the system.
> This program will gets the tty device they login on and counts the
> seconds until the user logs off the tty.
> can anybody help me writing this idea in C or simple shell as i am not
> a
> C programmer.
> I will really appreciate anyhelp in this regard
> SASA
>
> "Steve Greatbanks" <steve_greatbanks@hotmail.com> wrote in message news:<bosre5$1us2$1@otis.netspace.net.au>...
>> Perhaps look at auditing login and logout events and parsing the audit logs?
>>
>> "sasa queer" <sasa1973pk@yahoo.com> wrote in message
>> news:702930ee.0311112059.50bff090@posting.google.c om...
>> > Dears,
>> > Does aybody have some ideas in their minds to solve this problem.
>> >
>> > SASA
>> >
>> > sasa1973pk@yahoo.com (sasa queer) wrote in message

>> news:<702930ee.0311092108.2532b953@posting.google. com>...
>> > > Dears ,
>> > > I have been put into a difficult situation by one of my security
>> > > advisors...
>> > > whic is that if any one of the user login into the system and logout
>> > > within
>> > > same minute ( i.e if he logout from system in 45 seconds ) the last
>> > > command
>> > > could not be able to display the duration of user's session properly
>> > > as " last"
>> > > command shows ( 23:42-23:42) i.e in hh:mm format.
>> > > Now two questions:
>> > > 1.Is there any way to get the duration of session in seconds?
>> > >
>> > > 2.I know how to get the login time in seconds ( lsuser or
>> > > /etc/security/lastlog file) but does any body conceive any way to
>> > > record the logout time in same way?
>> > >
>> > > SASA


Instead of a c program that tracks the tty, how about a wrapper
program around the shell. In /etc/passwd call the wrapper that
writes the login time, then calls the shell, then waits for the
shell to exit, then writes the logout time.

Mike
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 01-04-2008, 08:52 PM
sasa queer
 
Posts: n/a
Default Re: login log time in seconds

Can any body help me more on writing such a
wrapper for me
It is infact a nice idea , but really appears a difficult one to
implement.

SASA
Mike <mikee@mikee.ath.cx> wrote in message news:<vr9k91sts16h98@corp.supernews.com>...
> In article <702930ee.0311132018.effc5e5@posting.google.com> , sasa queer wrote:
> > Thanks for suggestion!
> > But the auditing logs once again give the time in same manner ( hh:mm)
> > I have an idea to write a C program which should be executed in
> > background
> > whenever the user logs into the system.
> > This program will gets the tty device they login on and counts the
> > seconds until the user logs off the tty.
> > can anybody help me writing this idea in C or simple shell as i am not
> > a
> > C programmer.
> > I will really appreciate anyhelp in this regard
> > SASA
> >
> > "Steve Greatbanks" <steve_greatbanks@hotmail.com> wrote in message news:<bosre5$1us2$1@otis.netspace.net.au>...
> >> Perhaps look at auditing login and logout events and parsing the audit logs?
> >>
> >> "sasa queer" <sasa1973pk@yahoo.com> wrote in message
> >> news:702930ee.0311112059.50bff090@posting.google.c om...
> >> > Dears,
> >> > Does aybody have some ideas in their minds to solve this problem.
> >> >
> >> > SASA
> >> >
> >> > sasa1973pk@yahoo.com (sasa queer) wrote in message

> news:<702930ee.0311092108.2532b953@posting.google. com>...
> >> > > Dears ,
> >> > > I have been put into a difficult situation by one of my security
> >> > > advisors...
> >> > > whic is that if any one of the user login into the system and logout
> >> > > within
> >> > > same minute ( i.e if he logout from system in 45 seconds ) the last
> >> > > command
> >> > > could not be able to display the duration of user's session properly
> >> > > as " last"
> >> > > command shows ( 23:42-23:42) i.e in hh:mm format.
> >> > > Now two questions:
> >> > > 1.Is there any way to get the duration of session in seconds?
> >> > >
> >> > > 2.I know how to get the login time in seconds ( lsuser or
> >> > > /etc/security/lastlog file) but does any body conceive any way to
> >> > > record the logout time in same way?
> >> > >
> >> > > SASA

>
> Instead of a c program that tracks the tty, how about a wrapper
> program around the shell. In /etc/passwd call the wrapper that
> writes the login time, then calls the shell, then waits for the
> shell to exit, then writes the logout time.
>
> Mike

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 01-04-2008, 08:52 PM
Bruno
 
Posts: n/a
Default Re: login log time in seconds

"sasa queer" <sasa1973pk@yahoo.com> wrote in message
news:702930ee.0311150726.40f193ea@posting.google.c om...
> Can any body help me more on writing such a
> wrapper for me
> It is infact a nice idea , but really appears a difficult one to
> implement.
>


Have you looked at the AIX auditing and accounting? Maybe that would work.

http://publib-b.boulder.ibm.com/Redb...6020.html?Open

--
"I will jump five hundred feet
into block of cement!"
- Bruno the Magnificent


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 01-04-2008, 08:52 PM
Finnbarr P. Murphy
 
Posts: n/a
Default Re: login log time in seconds

Sasa,

Have a look at the O'Reilly Book "Perl for System Administration".
Chapter 9 (available online as an sample chapter) provides most
of the information needed, including sample code, to write a simple
Perl script to do the necessary.

- Finnbarr

sasa1973pk@yahoo.com (sasa queer) wrote in message news:<702930ee.0311150726.40f193ea@posting.google. com>...
> Can any body help me more on writing such a
> wrapper for me
> It is infact a nice idea , but really appears a difficult one to
> implement.
>
> SASA

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 01-04-2008, 08:52 PM
Mike
 
Posts: n/a
Default Re: login log time in seconds

In article <702930ee.0311150726.40f193ea@posting.google.com >, sasa queer wrote:
> Can any body help me more on writing such a
> wrapper for me
> It is infact a nice idea , but really appears a difficult one to
> implement.
>
> SASA
> Mike <mikee@mikee.ath.cx> wrote in message news:<vr9k91sts16h98@corp.supernews.com>...
>> In article <702930ee.0311132018.effc5e5@posting.google.com> , sasa queer wrote:
>> > Thanks for suggestion!
>> > But the auditing logs once again give the time in same manner ( hh:mm)
>> > I have an idea to write a C program which should be executed in
>> > background
>> > whenever the user logs into the system.
>> > This program will gets the tty device they login on and counts the
>> > seconds until the user logs off the tty.
>> > can anybody help me writing this idea in C or simple shell as i am not
>> > a
>> > C programmer.
>> > I will really appreciate anyhelp in this regard
>> > SASA
>> >
>> > "Steve Greatbanks" <steve_greatbanks@hotmail.com> wrote in message news:<bosre5$1us2$1@otis.netspace.net.au>...
>> >> Perhaps look at auditing login and logout events and parsing the audit logs?
>> >>
>> >> "sasa queer" <sasa1973pk@yahoo.com> wrote in message
>> >> news:702930ee.0311112059.50bff090@posting.google.c om...
>> >> > Dears,
>> >> > Does aybody have some ideas in their minds to solve this problem.
>> >> >
>> >> > SASA
>> >> >
>> >> > sasa1973pk@yahoo.com (sasa queer) wrote in message

>> news:<702930ee.0311092108.2532b953@posting.google. com>...
>> >> > > Dears ,
>> >> > > I have been put into a difficult situation by one of my security
>> >> > > advisors...
>> >> > > whic is that if any one of the user login into the system and logout
>> >> > > within
>> >> > > same minute ( i.e if he logout from system in 45 seconds ) the last
>> >> > > command
>> >> > > could not be able to display the duration of user's session properly
>> >> > > as " last"
>> >> > > command shows ( 23:42-23:42) i.e in hh:mm format.
>> >> > > Now two questions:
>> >> > > 1.Is there any way to get the duration of session in seconds?
>> >> > >
>> >> > > 2.I know how to get the login time in seconds ( lsuser or
>> >> > > /etc/security/lastlog file) but does any body conceive any way to
>> >> > > record the logout time in same way?
>> >> > >
>> >> > > SASA

>>
>> Instead of a c program that tracks the tty, how about a wrapper
>> program around the shell. In /etc/passwd call the wrapper that
>> writes the login time, then calls the shell, then waits for the
>> shell to exit, then writes the logout time.
>>
>> Mike


#!/bin/ksh

start=$SECONDS
$*
stop=$SECONDS
dur=`eval $stop - $start`
logger -p local1.info "$USER active for $dur seconds"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:34 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com