Wtmp not updating

The last command looks in the /var/adm/wtmpx file, whichrecords all logins and logouts, for information about auser, a terminal, or any group of users and terminals. To shorten the files only partially, use the dd command with the skipand ibs arguments to tell dd how many records to skip, and how long eachrecord is, respectively.

The ibs argument should be set to 36 for wtmp,and 372 for wtmpx.

## (Though comments for improvement are welcome at the above# e-mail address.)# Diagnostics:# Arguments:# optional - number of records to keep# or, if negative, to skip.# default: 60 ($KEEP)## Exit codes:# 0 - Successful completion# 1 - No truncation needed with current $KEEP# 2 - Error from cp detected# 3 - Error from dd detected## Notes:# This script will make a backup of your files in $TMPDIR# unless there is no truncation to be made, or there is an# error and it bails out.# Directory to store the temporary copies of the files:# (originally /tmp)TMPDIR=/tmp# Directory where the realfiles are stored:# (originally /var/adm)WDIR=/var/adm# List of files with record sizes, used for the for loop# (originally "wtmp:36 wtmpx:372")FILES="wtmp:36 wtmpx:372"# Number of records to keep if not modified by argument:# (originally 60, or

The last command looks in the /var/adm/wtmpx file, whichrecords all logins and logouts, for information about auser, a terminal, or any group of users and terminals. To shorten the files only partially, use the dd command with the skipand ibs arguments to tell dd how many records to skip, and how long eachrecord is, respectively.The ibs argument should be set to 36 for wtmp,and 372 for wtmpx.## (Though comments for improvement are welcome at the above# e-mail address.)# Diagnostics:# Arguments:# optional - number of records to keep# or, if negative, to skip.# default: 60 ($KEEP)## Exit codes:# 0 - Successful completion# 1 - No truncation needed with current $KEEP# 2 - Error from cp detected# 3 - Error from dd detected## Notes:# This script will make a backup of your files in $TMPDIR# unless there is no truncation to be made, or there is an# error and it bails out.# Directory to store the temporary copies of the files:# (originally /tmp)TMPDIR=/tmp# Directory where the realfiles are stored:# (originally /var/adm)WDIR=/var/adm# List of files with record sizes, used for the for loop# (originally "wtmp:36 wtmpx:372")FILES="wtmp:36 wtmpx:372"# Number of records to keep if not modified by argument:# (originally 60, or $1 if argument given)KEEP=$case "$KEEP" in -*) # set skip size for negative arguments SKIP=`echo $KEEP | cut -c2-` ;; *) # accept explicit positives KEEP=`echo $KEEP | cut -c2-` unset SKIP ;; *) unset SKIP;;esac# get the proper values, since $FILES is customizable.# these lines get the first entry in $FILESWTMPFILE=`echo $FILES | cut -d: -f1`WTMPSIZE=`echo $FILES | sed 's/^[^:]*:\([^ ]*\).*$/\1/'`FILESIZE=`ls -l L $WDIR/$WTMPFILE | awk ''` # obtain thefilesize of w tmp # for later calculations NUMRECS=`expr $FILESIZE / $WTMPSIZE` # Store the size of the # utmp file, in records SKIP=$ # number of records to skip, based on # $KEEP vs.number of records in the # wtmp [ $SKIP -le 0 ]then exit 1 # nothing to truncatefifor PAIR in $FILES # Pair of filename and block sizedo FILE=`echo $PAIR | cut -d: -f1` # extract filename IBS=`echo $PAIR | cut -d: -f2` # extract record size cp $WDIR/$FILE $TMPDIR/$FILE # copy original to tmp STATUS=$?Question, what exactly will I NOT be able to see if I zero it out?

||

The last command looks in the /var/adm/wtmpx file, whichrecords all logins and logouts, for information about auser, a terminal, or any group of users and terminals. To shorten the files only partially, use the dd command with the skipand ibs arguments to tell dd how many records to skip, and how long eachrecord is, respectively.

The ibs argument should be set to 36 for wtmp,and 372 for wtmpx.

## (Though comments for improvement are welcome at the above# e-mail address.)# Diagnostics:# Arguments:# optional - number of records to keep# or, if negative, to skip.# default: 60 ($KEEP)## Exit codes:# 0 - Successful completion# 1 - No truncation needed with current $KEEP# 2 - Error from cp detected# 3 - Error from dd detected## Notes:# This script will make a backup of your files in $TMPDIR# unless there is no truncation to be made, or there is an# error and it bails out.# Directory to store the temporary copies of the files:# (originally /tmp)TMPDIR=/tmp# Directory where the realfiles are stored:# (originally /var/adm)WDIR=/var/adm# List of files with record sizes, used for the for loop# (originally "wtmp:36 wtmpx:372")FILES="wtmp:36 wtmpx:372"# Number of records to keep if not modified by argument:# (originally 60, or $1 if argument given)KEEP=$case "$KEEP" in -*) # set skip size for negative arguments SKIP=`echo $KEEP | cut -c2-` ;; *) # accept explicit positives KEEP=`echo $KEEP | cut -c2-` unset SKIP ;; *) unset SKIP;;esac# get the proper values, since $FILES is customizable.# these lines get the first entry in $FILESWTMPFILE=`echo $FILES | cut -d: -f1`WTMPSIZE=`echo $FILES | sed 's/^[^:]*:\([^ ]*\).*$/\1/'`FILESIZE=`ls -l L $WDIR/$WTMPFILE | awk ''` # obtain thefilesize of w tmp # for later calculations NUMRECS=`expr $FILESIZE / $WTMPSIZE` # Store the size of the # utmp file, in records SKIP=$ # number of records to skip, based on # $KEEP vs.

number of records in the # wtmp [ $SKIP -le 0 ]then exit 1 # nothing to truncatefifor PAIR in $FILES # Pair of filename and block sizedo FILE=`echo $PAIR | cut -d: -f1` # extract filename IBS=`echo $PAIR | cut -d: -f2` # extract record size cp $WDIR/$FILE $TMPDIR/$FILE # copy original to tmp STATUS=$?

if argument given)KEEP=$case "$KEEP" in -*) # set skip size for negative arguments SKIP=`echo $KEEP | cut -c2-` ;; *) # accept explicit positives KEEP=`echo $KEEP | cut -c2-` unset SKIP ;; *) unset SKIP;;esac# get the proper values, since $FILES is customizable.# these lines get the first entry in $FILESWTMPFILE=`echo $FILES | cut -d: -f1`WTMPSIZE=`echo $FILES | sed 's/^[^:]*:\([^ ]*\).*$/

The last command looks in the /var/adm/wtmpx file, whichrecords all logins and logouts, for information about auser, a terminal, or any group of users and terminals. To shorten the files only partially, use the dd command with the skipand ibs arguments to tell dd how many records to skip, and how long eachrecord is, respectively.The ibs argument should be set to 36 for wtmp,and 372 for wtmpx.## (Though comments for improvement are welcome at the above# e-mail address.)# Diagnostics:# Arguments:# optional - number of records to keep# or, if negative, to skip.# default: 60 ($KEEP)## Exit codes:# 0 - Successful completion# 1 - No truncation needed with current $KEEP# 2 - Error from cp detected# 3 - Error from dd detected## Notes:# This script will make a backup of your files in $TMPDIR# unless there is no truncation to be made, or there is an# error and it bails out.# Directory to store the temporary copies of the files:# (originally /tmp)TMPDIR=/tmp# Directory where the realfiles are stored:# (originally /var/adm)WDIR=/var/adm# List of files with record sizes, used for the for loop# (originally "wtmp:36 wtmpx:372")FILES="wtmp:36 wtmpx:372"# Number of records to keep if not modified by argument:# (originally 60, or $1 if argument given)KEEP=$case "$KEEP" in -*) # set skip size for negative arguments SKIP=`echo $KEEP | cut -c2-` ;; *) # accept explicit positives KEEP=`echo $KEEP | cut -c2-` unset SKIP ;; *) unset SKIP;;esac# get the proper values, since $FILES is customizable.# these lines get the first entry in $FILESWTMPFILE=`echo $FILES | cut -d: -f1`WTMPSIZE=`echo $FILES | sed 's/^[^:]*:\([^ ]*\).*$/\1/'`FILESIZE=`ls -l L $WDIR/$WTMPFILE | awk ''` # obtain thefilesize of w tmp # for later calculations NUMRECS=`expr $FILESIZE / $WTMPSIZE` # Store the size of the # utmp file, in records SKIP=$ # number of records to skip, based on # $KEEP vs.number of records in the # wtmp [ $SKIP -le 0 ]then exit 1 # nothing to truncatefifor PAIR in $FILES # Pair of filename and block sizedo FILE=`echo $PAIR | cut -d: -f1` # extract filename IBS=`echo $PAIR | cut -d: -f2` # extract record size cp $WDIR/$FILE $TMPDIR/$FILE # copy original to tmp STATUS=$?Question, what exactly will I NOT be able to see if I zero it out?

||

The last command looks in the /var/adm/wtmpx file, whichrecords all logins and logouts, for information about auser, a terminal, or any group of users and terminals. To shorten the files only partially, use the dd command with the skipand ibs arguments to tell dd how many records to skip, and how long eachrecord is, respectively.

The ibs argument should be set to 36 for wtmp,and 372 for wtmpx.

## (Though comments for improvement are welcome at the above# e-mail address.)# Diagnostics:# Arguments:# optional - number of records to keep# or, if negative, to skip.# default: 60 ($KEEP)## Exit codes:# 0 - Successful completion# 1 - No truncation needed with current $KEEP# 2 - Error from cp detected# 3 - Error from dd detected## Notes:# This script will make a backup of your files in $TMPDIR# unless there is no truncation to be made, or there is an# error and it bails out.# Directory to store the temporary copies of the files:# (originally /tmp)TMPDIR=/tmp# Directory where the realfiles are stored:# (originally /var/adm)WDIR=/var/adm# List of files with record sizes, used for the for loop# (originally "wtmp:36 wtmpx:372")FILES="wtmp:36 wtmpx:372"# Number of records to keep if not modified by argument:# (originally 60, or $1 if argument given)KEEP=$case "$KEEP" in -*) # set skip size for negative arguments SKIP=`echo $KEEP | cut -c2-` ;; *) # accept explicit positives KEEP=`echo $KEEP | cut -c2-` unset SKIP ;; *) unset SKIP;;esac# get the proper values, since $FILES is customizable.# these lines get the first entry in $FILESWTMPFILE=`echo $FILES | cut -d: -f1`WTMPSIZE=`echo $FILES | sed 's/^[^:]*:\([^ ]*\).*$/\1/'`FILESIZE=`ls -l L $WDIR/$WTMPFILE | awk ''` # obtain thefilesize of w tmp # for later calculations NUMRECS=`expr $FILESIZE / $WTMPSIZE` # Store the size of the # utmp file, in records SKIP=$ # number of records to skip, based on # $KEEP vs.

number of records in the # wtmp [ $SKIP -le 0 ]then exit 1 # nothing to truncatefifor PAIR in $FILES # Pair of filename and block sizedo FILE=`echo $PAIR | cut -d: -f1` # extract filename IBS=`echo $PAIR | cut -d: -f2` # extract record size cp $WDIR/$FILE $TMPDIR/$FILE # copy original to tmp STATUS=$?

/'`FILESIZE=`ls -l L $WDIR/$WTMPFILE | awk ''` # obtain thefilesize of w tmp # for later calculations NUMRECS=`expr $FILESIZE / $WTMPSIZE` # Store the size of the # utmp file, in records SKIP=$ # number of records to skip, based on # $KEEP vs.

number of records in the # wtmp [ $SKIP -le 0 ]then exit 1 # nothing to truncatefifor PAIR in $FILES # Pair of filename and block sizedo FILE=`echo $PAIR | cut -d: -f1` # extract filename IBS=`echo $PAIR | cut -d: -f2` # extract record size cp $WDIR/$FILE $TMPDIR/$FILE # copy original to tmp STATUS=$?

wtmp not updating-57wtmp not updating-25

Note: The last command shows ABOUT half of the wtmpx entries in its output, as two entries are often on 1 line of the output, and some entries are not shown.Example of packages depending on correct utmp information is sysvinit (the shutdown program broadcast a message to all logged in users), acpi-support-base (will lock the screen with the console user's password for hibernation) and killer (kill processes of users without active console sessions).But my view is not shared by everyone, as for example can be seen in , where the maintainer of lightdm believe correctly updated utmp information is nice to have but not a requirement. For normal logins one of the programs processing the login (getty/login, sshd, ftpd) is responsible for updating it.On a reboot a new reboot entry is written and a timestamp is written for the old one.---------------------------------------------------------------#! /bin/sh## wtmp .truncate (/usr/adm/wtmp.truncate) -# truncate old records off of wtmp and wtmpx### This script was written by David Lindes, [email protected]# (c) Copyright 1994 by David Lindes.## Permission to copy this script as wanted/needed is granted,# provided that it is distributed in its ENTIRETY, including# this copyright notice and disclaimer, all comments, and the# complete script.Modifications may be made to the default# values of the TMPDIR, WDIR, KEEP and FILES variables, but any# other modifications will be considered a violation of the# copyright agreement.## No distribution of this script should be for any monetary or# compensatory charge without prior written consent of the# author.## The default values given were written for the Solaris 2.3# (Sun OS 5.3) operating system, and should be verified before# use on any other operating system.## NO GUARANTEE IS GRANTED AS TO THE BEHAVIOR OF THIS SCRIPT, AND# NO WARRANTY SHALL BE ISSUED, IMPLIEDOR OTHERWISE, BY THE AUTHOR,# BY SUN MICROSYSTEMS, OR BY ANY OTHER INDIVIDUAL OR COMPANY.## USE THIS SCRIPT AT YOUR OWN RISK!!!!Hi all, Is there a way to selectively stop writing of certain events (ftp in this case) to wtmpx?If not is the rcommendation to zero out the file at intervals using a cron job or truncating it? Thanks 25-10516-1Document Audience: SPECTRUMDocument ID: 10516Title: WTMP/WTMPX: how to truncate wtmp and wtmpx Update Date: Fri Apr 19 MDT 2002Products: Solaris Best Regards, Franz--Solaris System Manager from Munich, Germany I used to work for Sun Microsystems Support (EMEA) for 5 years in the domain of the OS, Backup and Storage I don't have an on-line account as now Sunsolve wantsonly paying members with a service plan. But on to truncating, If I do truncate what shall I do with the truncated file?The script below will automatically shorten the files, so there is noneed to use dd directly.Note: Given an argument of 0, this script will also empty the file, if so desired.

Leave a Reply

Your email address will not be published. Required fields are marked *

One thought on “wtmp not updating”

  1. Signup here [ Trade Traffic ] [ Webmasters ] W A R N I N G : This Site Contains Adult Material All Models Appearing On All In Were At Least 18 Years Of Age At The Time Of The Photography.