Hp-Unix user login file collection

Dear All,

how to check the unix log file which mean how many(who) user has been log in the server for the day, when they log in & when they log out?

Hello,

The last command in HP-UX shows the successful log details of the users
and lastb command is used to bad login details.

Regards,
Santhi.

use man last

you can use last | grep "May 10" for 10th may for successfull logins
and lastb | | grep "May 10" for unsuccessfull logins.

Cheers,

Awadhesh

Dear All,

Thks for your information!

Anyhow, how can i use this log file and send to my email everyday ontime.
for example every 6:00pm, i will receive this log file and write a report.

do yours have any idea?

# Script Name: /dir/scr.sh
#! /usr/bin/ksh
DATE=`date "+DATE:%m.%d.%y"`
> /tmp/$DATE
echo "Details of Last Succesfull Logins are Below:" >>/tmp/$DATE
aw=`date | awk '{print $1,$2,$3}'`
last | grep "$aw" >> /tmp/$DATE
echo "Details of Last Failed Logins are Below:" >>/tmp/$DATE
lastb | grep "$aw" >> /tmp/$DATE
cat /tmp/$DATE | mailx -s "Todays Details" abc@def.gh
#Script End

Set this script to crontab
#crontab -e
0 18 * * * /dir/scr.sh

Cheers,

Awadhesh Pandey

Thks Awa.

Anyway, how to capture the IP address instead of username?
for example as below:-

Details of Last Succesfull Logins are Below:
user1 pts/tc Sat May 13 12:00 still logged in
ora1 ftp Sat May 13 10:56 still logged in
user2 pts/td Sat May 13 10:28 - 10:53 (00:24)
user1 pts/tc Sat May 13 10:14 - 10:52 (00:38)
user1 pts/tc Sat May 13 10:10 - 10:14 (00:03)
ora1 pts/tc Sat May 13 09:52 - 10:03 (00:10)
ahle pts/tb Sat May 13 09:51 still logged in
ahle pts/ta Sat May 13 09:50 still logged in
ahle remshd Sat May 13 08:00 - 08:00 (00:00)

Can it show the usename and IP address as well in the log?
pls comment!

thks.

Use the -R switch with the last command in HP-UX. On Sun, the switch is -a.

thks blow.....

Dear All,

Based on the below information . how to filter out the information like ftp connection . Only list out the Telnet connection information.

Details of Last Succesfull Logins are Below:
localcm ftp tpe5 Mon May 29 16:56 - 16:56 (00:00)
localcm ftp tpe5 Mon May 29 16:53 - 16:53 (00:00)
localcm ftp tpe5 Mon May 29 16:47 - 16:47 (00:00)
localcm ftp tpe5 Mon May 29 16:41 - 16:41 (00:00)
localcm ftp tpe5 Mon May 29 16:35 - 16:35 (00:00)
localcm ftp ialtpe5.wanhai.c Mon May 29 16:35 - 16:35 (00:00)
localcm ftp tpe5 Mon May 29 16:29 - 16:29 (00:00)
localcm ftp ialtpe5cifs.wanh Mon May 29 16:29 - 16:29 (00:00)
localcm ftp tpe5 Mon May 29 16:26 - 16:26 (00:00)
localcm ftp tpe5 Mon May 29 16:20 - 16:20 (00:00)
localcm ftp ialtpe5.wanhai.c Mon May 29 16:17 - 16:17 (00:00)
localcm ftp tpe5 Mon May 29 16:14 - 16:14 (00:00)
localcm ftp tpe5 Mon May 29 16:11 - 16:11 (00:00)
localcm ftp tpe5 Mon May 29 16:05 - 16:05 (00:00)
localcm ftp ialtpe5.wanhai.c Mon May 29 16:05 - 16:05 (00:00)
localcm ftp tpe5 Mon May 29 15:59 - 15:59 (00:00)
localcm ftp ialtpe5cifs.wanh Mon May 29 15:59 - 15:59 (00:00)
localcm ftp tpe5 Mon May 29 15:53 - 15:53 (00:00)
localcm ftp ialtpe5.wanhai.c Mon May 29 15:53 - 15:53 (00:00)
localcm ftp tpe5 Mon May 29 15:50 - 15:50 (00:00)
user01 console Mon May 29 15:47 - 16:11 (00:23)
localcm ftp tpe5 Mon May 29 15:44 - 15:44 (00:00)
localcm ftp tpe5 Mon May 29 15:38 - 15:38 (00:00)
localcm ftp tpe5 Mon May 29 15:32 - 15:32 (00:00)

any idea??
pls kindly let me know how to do in the script?