- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Login Information
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2008 06:06 AM
08-28-2008 06:06 AM
How can I use the old wtmp file along with the current one to get this report done?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2008 06:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2008 06:16 AM
08-28-2008 06:16 AM
Re: Login Information
You give following:
#lastb -f
where:
-f file Use file as the name of the accounting file instead of /var/adm/wtmp or /var/adm/btmp.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2008 06:26 AM
08-28-2008 06:26 AM
Re: Login Information
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2008 06:27 AM
08-28-2008 06:27 AM
Re: Login Information
Prior to trimming the file, it might pay to make a backup if management wants records from the distant past.
the lastb command gives non-binary output to /var/adm/btmp and the last command does the same for /var/adm/wtmp
Note that -r option gives the remote IP address, which is standard output in the Linux version of the utility.
passwd -sa might provide good data to cross check against manually
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2008 06:31 AM
08-28-2008 06:31 AM
Re: Login Information
You could do something like this:
#!/usr/bin/sh
MYWTMP=/var/adm/wtmp.backup #...change me...
OLDIFS=${IFS}
IFS=":"
while read USER X
do
last -1 ${USER} -f ${MYWTMP}|grep -Ev "^$|^wtmp begins"
done < /etc/passwd
IFS=${OLDIFS}
exit 0
...This will produce one-line output for every user in your '/etc/passwd' with an entry in your 'wtmp' backup. Only the most recent login information (one line per user) will be printed.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2008 06:55 PM
08-28-2008 06:55 PM
Re: Login Information
Here is a script something like JRF's script in your other link:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1263622
The output looks like:
root 0 0 0 Wed Aug 27 13:13
Note this just checks the current system with last(1).
sort passwd1 passwd2 passwd3 | awk -F: '
function do_print() {
save_line = name " " uid
last_command = "last -1 " name
name = $1; uid = $3
FS=" "
xx = last_command | getline
if (xx == 1)
print save_line, $3, $4, $5, $6
else
print save_line, "???"
FS=":"
}
BEGIN { getline; name = $1; uid = $3 }
{
if ($1 == name) {
uid = uid " " $3
} else {
do_print()
}
}
END { do_print() } '