- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Cleaning up utmp/wtmp/btmp/utmpx/wtmpx and maintai...
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
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
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
тАО09-08-2005 08:51 AM
тАО09-08-2005 08:51 AM
Good old wtmp continues to grow and grow. There are numerous suggestions to 1) Truncate/null/zero out the file or 2) Convert the file to ascii, trim some rows, convert the file back to binary and replace.
I recall having problems with both methods in the past because both the who and last commands did not always return the correct data so I ended up deciding to only null out the files when I reboot.
Well, I have a server that's been up for 360 days and I do not really want to reboot. File is 70 MB.
Has anybody ran into any tools or scripts that cleans up the files that also ensures that the currently logged in entries remain?
I'm really surprised that a tool or UNIX utility does not already exist.
Like I said earlier, zeroing out the files is not an option unless I reboot right after.
Thanks in advance.
jack...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-08-2005 08:59 AM
тАО09-08-2005 08:59 AM
Solution/var/adm/wtmp file gets bigger in size , though the others are not much bigger.
And it contains the last login data of user and accounting information . So you can copy it to other place , if you want and nullify the file .
# cd /var/adm/wtmp
# cp wtmp /otherplace
# > wtmp
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-08-2005 09:03 AM
тАО09-08-2005 09:03 AM
Re: Cleaning up utmp/wtmp/btmp/utmpx/wtmpx and maintaining integrity
Another safer method is :
# cd /var/adm
# cat /dev/null > wtmp
# cat /dev/null > btmp
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-08-2005 09:04 AM
тАО09-08-2005 09:04 AM
Re: Cleaning up utmp/wtmp/btmp/utmpx/wtmpx and maintaining integrity
I remember the who command not working when we zeroed out the file.
jack...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-08-2005 09:16 AM
тАО09-08-2005 09:16 AM
Re: Cleaning up utmp/wtmp/btmp/utmpx/wtmpx and maintaining integrity
I know a lot of people will not use SAm on general principle, but there is selection in one of SAM menus to trim log files. You could go through the exercise in SAM and then look at the SAM log to get the exact commands.
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-08-2005 09:18 AM
тАО09-08-2005 09:18 AM
Re: Cleaning up utmp/wtmp/btmp/utmpx/wtmpx and maintaining integrity
A reboot is not required after null'ing the files.
Save off an ASCII version of the file(s). Then null the file. Issue the who or last command - the output should be nothing.
Convert the ASCII file back to binary format then issue the who or last command. Should get the output as expected as there is now data is these file(s)
wtmp - a system audit file
Stores the LAST info
Stored in BINARY format
to convert to ASCII, /usr/sbin/acct/fwtmp -X < wtmps > wtmps.rdg
this will store the data in ASCII format in the wtmps.rdg file
to convert to binary, usr/sbin/acct/fwtmp -ic < wtmps.rdg > wtmps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-08-2005 09:25 AM
тАО09-08-2005 09:25 AM
Re: Cleaning up utmp/wtmp/btmp/utmpx/wtmpx and maintaining integrity
You should not make the utmp file null.
This contains a record of all users logged onto the system. Its usually 1KB to 2KB in size.
And you can null other files wtmp and btmp , thats are grows and quite big and keeps records of login logout and , btmp( bad logins).
So if you make "/etc/utmp" null , who and last may not work correctly. And you need to reboot then . So be careful.
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-08-2005 04:54 PM
тАО09-08-2005 04:54 PM
Re: Cleaning up utmp/wtmp/btmp/utmpx/wtmpx and maintaining integrity
Normally when only a few users are logged into the system then nulling out should not cause any problems in last command.
However with a uptime of 360 days the file size or 70MB for /var/adm/wtmp means the no. of users logging in are quite high.
You should try the same operation using
SAM-> Routine Tasks->System Log Files->Select /var/adm/wtmp and from actions Trim to Zero.
It does not show any errors in last command when I trimmed in using SAM.
Try the same and share the results.
HTH,
Devender
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2005 04:56 AM
тАО09-12-2005 04:56 AM
Re: Cleaning up utmp/wtmp/btmp/utmpx/wtmpx and maintaining integrity
You'll notice the /etc/utmp is a simple file in / (this would not be allowed by good design if it could grow large), while btmp and wtmp are actually symlinks into /var/adm, presumably anticipating possible boundless growth -- usually /var has plenty free space.
bv