1827293 Members
3844 Online
109717 Solutions
New Discussion

Getting info out of btmp

 
SOLVED
Go to solution
Stefan Rahm
Occasional Contributor

Getting info out of btmp

I am trying to, in a nice way, read the different parts of information in the /var/adm/btmp-file. Is there any function that already does this, I am not looking for lastb, or do I need to get my haneds dirty?
6 REPLIES 6
Steven Sim Kok Leong
Honored Contributor

Re: Getting info out of btmp

Hi,

Use strings ie.

# strings /var/adm/btmp

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
CHRIS_ANORUO
Honored Contributor

Re: Getting info out of btmp

You can get more info from lastb by using lastb -R|pg or achieving the information to a file:
cat /var/adm/btmp | /usr/sbin/acct/fwtmp > /tmp/ascii_btmp

When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.
Stefan Rahm
Occasional Contributor

Re: Getting info out of btmp

I appreciate the help I've been given, but I think I am looking for something akin to getpwent(). If that doesn't exist then the help I've been given is gratefully accepted.
Andreas Voss
Honored Contributor

Re: Getting info out of btmp

Hi,

if you plan to write a c program you could use the system call getut() to examine the btmp file.
See 'man getut'

Regards
Stefan Rahm
Occasional Contributor

Re: Getting info out of btmp

=) Now my only problem is that it seems to read from a different file, not btmp, wtmp nor utmp. What am I doing wrong?
Andreas Voss
Honored Contributor
Solution

Re: Getting info out of btmp

Hi,

before using getut set the file you want to read with ie:

utmpname("/var/adm/btmp");

Regards