Sponsored Content
Full Discussion: wtmp file
Operating Systems AIX wtmp file Post 302201180 by bakunin on Saturday 31st of May 2008 04:14:59 PM
Old 05-31-2008
/var/adm/wtmp holds accounting information. You will get a detailed explanation by reading the manpage for it (yes, there is one): "man wtmp".

You can of course delete it, but chances are you do your filesystem no good, because /var/adm/wtmp is constantly being written to. Also you will change the inode of the file which some system routines won't like very much.

If you want to trim it with the system running use:

Code:
cat /dev/null > /var/adm/wtmp

To remedy your problem: boot in maintenance mode, remove the file, reboot. The file will be created correctly. From then on you can use the above mentioned procedure to trim it.

I hope this helps.

bakunin
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need Wtmp Reader

I would loke to read the WTMP file. This is a binary file in the /var/logs directory. Is there any utility which will convert this binary file to ASCII format? (1 Reply)
Discussion started by: pgold1
1 Replies

2. UNIX for Dummies Questions & Answers

manage the wtmp file

Here's a usefull perl script to trim the wtmp file, in case it got too big, which happens sometimes, or got curropted (which also happens often). You could learn from here how to parse the wtmp file... but of course for just reading its content always simply use "last" like Neo said.... ... (0 Replies)
Discussion started by: me2unix
0 Replies

3. UNIX for Dummies Questions & Answers

Resetting WTMP?

When I type last oracle I get dates from Nov 28, 2000 all the way back to the beginning of time it seems. The 11-28-2000 entry states that Oracle is still logged in, but if you type a who, it shows only 1 entry - the currently logged in user (Me as oracle), but I logged in only minutes ago - and... (4 Replies)
Discussion started by: cuppjr
4 Replies

4. UNIX for Dummies Questions & Answers

wtmp

Hi, is it ok if i delete wtmp on HPUX 11 under /var/adm It is filling up that filesystem Cheers (2 Replies)
Discussion started by: dsharples
2 Replies

5. Programming

Displaying fields in wtmp file?

Anyone have any idea on how to display the fields for each record stored in the wtmp file using C? Am I correct in thinking that the info stored in wtmp is in binary and that utmpx will be of some help? Being a beginner, I can come up with bits and pieces of what I might need in order to do the... (1 Reply)
Discussion started by: eclapton1
1 Replies

6. UNIX for Dummies Questions & Answers

truncate wtmp

I have AIX5.1 I have been trying to learn how to truncate the /var/adm/wtmp file. I have seen several things on google actually but don't quite understand. I also searched your forums but couldn't find it. one says this ">/var/adm/wtmp Is that all I do? I have a seperate question also. I was... (1 Reply)
Discussion started by: rocker40
1 Replies

7. AIX

WTMP file cleared after upgrade

Hello, we recently upgraded from AIX 5.2.9 to 5.3.6 and in the process the wtmp file was cleared out. Before the upgrade the system had not been rebooted in a very long time, so i'm curious if the clearing of the file is related to the upgrade or the reboot? If it was related to the reboot is... (2 Replies)
Discussion started by: zuessh
2 Replies

8. AIX

Impacts of emptying /var/adm/wtmp file ?

In our operating procedures, if a workstation has a space problem in the /var filesystem, one of the most frequent case we were told is the size of the /var/adm/wtmp file. Someone once told me it is dangerous to do this. Is it ? I cannot say for certain that whomever wrote that procedure is... (2 Replies)
Discussion started by: Browser_ice
2 Replies

9. AIX

wtmp file - is there a patch to export the data another file each day?

sorry for being a noob, i am trying to find which user accessed the server at what time and there ip address at first i used who command but the output didn't contain the ip address then i used the last command which provided me with the ip of the users but when i searched i searched and found that... (1 Reply)
Discussion started by: hercules_1010
1 Replies
WRITETMP(8)						      System Manager's Manual						       WRITETMP(8)

NAME
writetmp - write special wtmp entries to a wtmp file. SYNOPSIS
writetmp [-w wtmp|-] [-X[3|4]] [-u user] [-l line] [-h host] [-i id] [-p pid] [-t type] [-c comment] [--help] [--version] [entry-type] DESCRIPTION
Writetmp is a utility to write special entries to a wtmp file. Useful as either a replacement for the functionality of the "halt -w" or "reboot -w" commands which are normally run at shutdown time or to write special wtmp entries to an alternate wtmp file to which such entries would normally not be written. Under normal conditions radius radtwmp or tacacs accounting logs do not contain shutdown and boottime entries because the access control software is not setup to take into account these events. In the case of a quick shutdown or server crash, the wtmp file(s) will lose coherency. To avoid or minimize the amount of accounting error, it is necessary to write shutdown and boottime entries to such logs. Also changes in time which are made manually with date or via the network with a program such as rdate are not reflected in the accounting logs, which, if the time difference is severe can improperly account time for logins active during the time change. If an entry-type is specified on the command line, the -u, -l, -h, -i, -p, -t and -c options are ignored as writetmp will fill in the user- name, line, id, and host entries as required for that particular wtmp entry-type. Writetmp understands the following entry types: shutdown used just prior to a normal system shutdown. Also accepts halt or reboot as aliases for shutdown. boottime used at system initialization time, to indicate the system is booting. oldtime Indicates the time is about to change. newtime Indicates the time has changed. The difference in time is determined from the timestamp on the last oldtime entry. runlevel Indicates a change in runlevel (useless in an accounting sense). OPTIONS
Writetmp understands the following command line switches: --help Outputs a verbose usage listing. --version Displays the version of writetmp. -w wtmp Select a different output file instead of the default (/var/log/wtmp). -X[3] Write to a wtmp file maintained by versions 3.3 or 3.4 Tacacs terminal server access control software. -X4 Write to a wtmp file maintained by version 4.0 of Tacacs terminal server access control software. -u user Specify the username for the username field. -l line Specify the tty name for the line field. -h host Specify the hostname. -i id Specify the init id name. Not applicable to tacacs wtmp files. -p pid Specify the pid number. Not appliccable to tacacs wtmp files. -t type Specify the type of wtmp entry for the ut_type field, not to be confused with entry-type. May be coded as a number or one of: unknown, runlevel, boottime, newtime, oldtime, init, login, user or dead. -c comment Specify the comment for the tacacs 4 wtmp comment field (16 characters max). EXAMPLES
Write a shutdown message to an alternate wtmp log: writetmp -w /var/adm/xtmp shutdown A shell script to update the time in an alternate wtmp file when netdate is run: #!/bin/sh writetmp -w /var/adm/xtmp oldtime netdate clock.llnl.gov writetmp -w /var/adm/xtmp newtime Find out how often and for how long people run a specific program, such as pine: #!/bin/sh # /var/adm/cmdtmp must be globally writable. cmdtmp=/var/adm/cmdtmp writetmp -w $cmdtmp -u pine -l cmd$$ -h $USER -t user /path/to/real-pine $* writetmp -w $cmdtmp -l cmd$$ -t dead FILES
/var/log/wtmp login database. AUTHOR
Steve Baker (ice@mama.indstate.edu) BUGS
Does not lock the wtmp file and does not guarantee a successful write. Could in theory corrupt a log file. Rdate and netdate can take seconds to complete, so writing oldtime/newtime records around them may not be entirely accurate. SEE ALSO
date(1), last(1), sac(8), netdate(8L), reboot(8) UNIX Manual WRITETMP(8)
All times are GMT -4. The time now is 02:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy