- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: last command shows the user even though user h...
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-29-2007 05:30 AM
08-29-2007 05:30 AM
last command shows the user even though user has logged out
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2007 05:40 AM
08-29-2007 05:40 AM
Re: last command shows the user even though user has logged out
I consider this pretty much a waste of time because using who/last to determine users on the systems is not very reliable --- and this applies to all flavors of UNIX. The process table (ps) is really the reliable method.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2007 06:46 AM
08-29-2007 06:46 AM
Re: last command shows the user even though user has logged out
1. Ensure that the wtmp file is not corrupt by running a last on your user id:
# last ` who am i `
2. Convert the wtmp file to ascii into a file system that has sufficient space:
# cat /var/adm/wtmp | /usr/sbin/acct/fwtmp > /tmp/ascii_wtmp
3. Determine the number of lines in the ascii file, take 10% of that value, and subtract that from total number of lines:
# lines=`cat /tmp/ascii_wtmp | wc -l`;lines2=`expr $lines / 10`; export lines3=`expr $lines - $lines2`;echo $lines3
4. Start the ascii file from the line number given as output from the above command:
# awk ' ( NR > '$lines3' ) ' /tmp/ascii_wtmp > /tmp/ascii_wtmp2
5. Convert the trimmed ascii file back to binary in place of the original wtmp:
# cat /tmp/ascii_wtmp2 | /usr/sbin/acct/fwtmp -ic > /var/adm/wtmp
6. Verify that the operation was successful
# ll /var/adm/wtmp
# last ` who am i `
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2007 07:34 AM
08-29-2007 07:34 AM
Re: last command shows the user even though user has logged out
As noted who and derivitives are m much better.
Note that if you never trim your wtmp file, it can get bit and make the chances of a false reading like this go up.
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-29-2007 02:42 PM
08-29-2007 02:42 PM
Re: last command shows the user even though user has logged out
You may backup the btmp and wtmp files so you would have the login information
and then remove these files from the system. It is recommended to first see
how fast the files grow, and then schedule a cron job to backup and trim the
files.
wtmp and btmp can be zeroed out using the following:
cat /dev/null > /var/adm/wtmp
cat /dev/null > /var/adm/btmp
Rather than using the commands: rm, touch, chmod, chown, chgrp in order to
create an empty file, the cat /dev/null technique retains all the
characteristics of the old file. Note that zeroing /var/adm/wtmp on a running
system may cause errors to be reported from the who command. These
errors are caused by who not finding the users currently logged in.
The best way to trim /var/adm/wtmp is to do it in single user mode. Do not
zero the /etc/utmp...this is done automatically.
or
You can also use
SAM -> Routine Tasks -> System Log Files
to trim wtmp, btmp and other log files.
WK
please assign points
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2007 07:16 PM
08-29-2007 07:16 PM
Re: last command shows the user even though user has logged out
> /var/adm/wtmp
does exactly the same as cp /dev/null etc.
Mark Syder (like the drink but spelt different)