Operating System - HP-UX
1827279 Members
2602 Online
109717 Solutions
New Discussion

Looking for a use log file

 
ajk_2
Advisor

Looking for a use log file

Dear all,

Could you tell me which log file can show their login status? I want to delete some inactive users according the log file. Thanks a lot!

Regards
ajk
7 REPLIES 7
Ruediger Noack
Valued Contributor

Re: Looking for a use log file

Hi,

you can create an ascii log file with:
last >

Ruediger
Hartmut Lang
Trusted Contributor

Re: Looking for a use log file

Well, i don't completely understand what you want to achieve.

There is /var/adm/wtmp and /var/adm/btmp which can be viewed with last and lastb (see "man last").
And there is who -a.

Hardy
Printaporn_1
Esteemed Contributor

Re: Looking for a use log file

Hi,

Use w,last and lastb.
enjoy any little thing in my life
Animesh Chakraborty
Honored Contributor

Re: Looking for a use log file

Hi,
Try
#who -uH
look for idle time column.
Another command is finger
#finger username
Did you take a backup?
Steve Steel
Honored Contributor

Re: Looking for a use log file

Hi

The ksh and sh have an option to timeout the users after an idle period expressed in seconds.

This can be set in the profile of the user.

man page of posix gives

TMOUT If set to a value greater than zero, the shell will
terminate if a command is not entered within the
prescribed number of seconds after issuing the PS1
prompt. (Note that the shell can be compiled with a
maximum bound for this value which cannot be exceeded.)


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Paula J Frazer-Campbell
Honored Contributor

Re: Looking for a use log file

Hi

This will look for all users that have been idle for over two hours and zap them.

Use grep -v to exclude users that you wish to excluse from this tidy up routine.

[2-9] in the script = two - nine hours, so [1-9] will zap users over one hours idle.

who -u | egrep " [2-9]:" | grep -v root | awk '{print $7}' | xargs kill

HTH

Paula
If you can spell SysAdmin then you is one - anon
Peter Kloetgen
Esteemed Contributor

Re: Looking for a use log file

Hi ajk,

you can solve your problems by setting the TMOUT variable for each user:

in $HOME/.profile make the following entry

TMOUT=3600

this makes a shell killing itself, if there was no action by the user for a period of an hour ( 3600 seconds... ). If they use CDE, please look into $HOME/.dtprofile and take care of the following variable at the end of the script:

DTSOURCEPROFILE=true

It has to be uncommented. ( Remove the # )

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping