Reading wtmps file


 
Thread Tools Search this Thread
Operating Systems HP-UX Reading wtmps file
# 1  
Old 02-09-2016
Reading wtmps file

I'm sure there might be an answer here. I have searched but cannot find specifics. I have wtmps file exported to a txt file for reading. The code for the export I believe is this.
Code:
if [ ${OS_VERSION} = "B.11.11" ]; then
    for file in $(ls -1 /var/adm/wtmp.*|grep -v gz)
    do
      /usr/sbin/acct/fwtmp -X < ${file} >> ${REPORTDIR}/successful-logins-all
    done
    if [ -f /var/adm/wtmp ]; then 
      /usr/sbin/acct/fwtmp -X < /var/adm/wtmp >> ${REPORTDIR}/successful-logins-all
    fi
  else
    for file in $(ls -1 /var/adm/wtmps.*|grep -v gz)
    do
      /usr/sbin/acct/fwtmp -X < ${file} >> ${REPORTDIR}/successful-logins-all
    done
    if [ -f /var/adm/wtmps ]; then 
      /usr/sbin/acct/fwtmp -X < /var/adm/wtmps >> ${REPORTDIR}/successful-logins-all
    fi
  fi

I'm not an expert just auditing. when I open output file this is an example of lines I see.

Code:
     dev/              18096  8 0000 0000 1448946032 416868 Dec  1 00:00:32 2015 0  
         dev/              18123  8 0000 0000 1448946038 364909 Dec  1 00:00:38 2015 0  
         dev/              18126  8 0000 0000 1448946038 381202 Dec  1 00:00:38 2015 0  
         dev/              18149  8 0000 0000 1448946048 259553 Dec  1 00:00:48 2015 0  
         dev/              18191  8 0000 0000 1448946059 377515 Dec  1 00:00:59 2015 0

My question then is really what is this information telling me? I cannot seem to find anything that tells me what the output means.

Thank you much,

Last edited by jim mcnamara; 02-09-2016 at 06:24 PM..
# 2  
Old 02-09-2016
This looks like HPUX.

Specifically look at Methyl's answer about reading the man page.
/var/adm/wtmps questions

There are C structs that show layout of data in the wtmpxx files I believe.
# 3  
Old 02-10-2016
The -X option is for the /var/adm/wtmps.* files, otherwise fwtmp reads the /var/adm/wtmp.* files.
I have no clue what the extra numbers mean. The man pages are too short (and a bit confusing).
If you want to try the last command, the following extracts most out of the files:
Code:
last -Rf /var/adm/wtmp
last -XxRf /var/adm/wtmps

--
Normally, at least during a system login, wtmp and wtmps are written simultaneously. wtmps has room for more information. So reading wtmps alone should be sufficient.

Last edited by MadeInGermany; 02-10-2016 at 06:18 AM..
# 4  
Old 02-10-2016
Thank you for responses. May have to work with server admins to run new commands. If I have a copy of the wmtp file exported to a Windows server is there a way to run the last command from some shell to view the file?
thanks.
# 5  
Old 02-10-2016
No, the wtmp file is binary, and must be processed by the commands on the system.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh Script, Reading A File, Grepping A File Contents In Another File

So I'm stumped. First... APOLOGIES... my work is offline in an office that has zero internet connectivity, as required by our client. If need be, I could print out my script attempts and retype them here. But on the off chance... here goes. I have a text file (file_source) of terms, each line... (3 Replies)
Discussion started by: Brusimm
3 Replies

2. UNIX for Dummies Questions & Answers

Reading Xml file and print the values into the text file in columnwise?

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (4 Replies)
Discussion started by: sravanreddy
4 Replies

3. UNIX for Dummies Questions & Answers

Reading XML file and print the values in the text file using Linux shell script

hi guys, i want help... Reding XML file and print the values into the text file using linux shell script file as per below xml file <sequence> <Filename>aldorzum.doc</Filename> <DivisionCode>US</DivisionCode> <ContentType>Template</ContentType> <ProductCode>VIMZIM</ProductCode> </sequence>... (1 Reply)
Discussion started by: sravanreddy
1 Replies

4. Shell Programming and Scripting

Reading UNIX commands from file and redirecting output to a file

Hi All I have written the following script: #!/bin/ksh while read cmdline do echo `$cmdline` pid="$cmdline" done<commands.txt =========== commands.txt contains: ps -ef | grep abc | grep xyz |awk '{print $2}; My objective is to store the o/p of the command in a variable and do... (8 Replies)
Discussion started by: rahulparo
8 Replies

5. Shell Programming and Scripting

fatal: cannot open file `TNAME' for reading (No such file or directory)

Hi, I am running this command through a shell script and getting the error mentioned in the subject line: testing.awk -f x.txt TNAME My testing.awk file contains something like ++++++++++++++++++ #!/usr/bin/awk -f BEGIN{ TAB_NAME="INSERT_ONE_" ARGV ; } if ( $1=="JAM_ONE" &&... (1 Reply)
Discussion started by: kunwar
1 Replies

6. Shell Programming and Scripting

Searching for Log / Bad file and Reading and writing to a flat file

Need to develop a unix shell script for the below requirement and I need your assistance: 1) search for file.log and file.bad file in a directory and read them 2) pull out "Load_Start_Time", "Data_File_Name", "Error_Type" from log file 4) concatinate each row from bad file as... (3 Replies)
Discussion started by: mlpathir
3 Replies

7. UNIX for Dummies Questions & Answers

/var/adm/wtmps questions

I have 2 boxes running HP-UX B.11.23 U ia64, one production, one development. I just found out that "last" is not working on the production machine. After some investigation, I find that the /var/adm/wtmps file has been allowed to grow and then has not been touched since Dec 2007. /var/adm/wtmp... (2 Replies)
Discussion started by: LisaS
2 Replies

8. UNIX for Advanced & Expert Users

Reading a file and sending mail based on content of the file

Hi Gurus, I am having an requirement. i have to read a list file which contains file names and send mail to different users based on the files in the list file. eg. if file a.txt exists then send a mail to a@a.com simillary for b.txt,c.txt etc. Thanks for your help, Nimu (6 Replies)
Discussion started by: nimu1979
6 Replies

9. Shell Programming and Scripting

Reading file names from a file and executing the relative file from shell script

Hi How can i dynamically read files names from a list file and execute them from a single shell script. Please help its urgent Thanks in Advance (4 Replies)
Discussion started by: anushilrai
4 Replies
Login or Register to Ask a Question