Solved

Linux: lastb not working after I delete btmp

Posted on 2013-11-18
2
985 Views
Last Modified: 2013-11-18
My /var/log/btmp file was too large so I deleted it.  I then created a new file with the same name and permissions:
touch /var/log/btmp
chown root:utmp /var/log/btmp
chmod 600 /var/log/btmp

Open in new window

The problem is that now new items are NOT logged.

$ lastb
btmp begins Mon Nov 18 06:38:03 2013

I use CentOS.

I found this link, demonstrating that I am not the only one to experiance this problem:
http://www.linuxforums.org/forum/red-hat-fedora-linux/35328-lastb-command-not-working.html
0
Comment
Question by:hankknight
  • 2
2 Comments
 
LVL 10

Accepted Solution

by:
Luxana earned 500 total points
ID: 39657074
try change permissions. They should be:

-rw-rw---- 1 root utmp

do:

chmod 660 /var/log/btmp

at the moment only root has wr permissions to this file..
0
 
LVL 10

Expert Comment

by:Luxana
ID: 39657108
BTW: never delete your log files unless you have to. Best way to clean your log files is  simply to remove the content with:

# > /var/log/btmp

the above will simply remove content of the file while keeping file permissions intact.

cheers...
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This document is written for Red Hat Enterprise Linux AS release 4 and ORACLE 10g.  Earlier releases can be installed using this document as well however there are some additional steps for packages to be installed see Metalink. Disclaimer: I hav…
You ever wonder how to backup Linux system files just like Windows System Restore?  Well you can use Timeshift in Linux to perform those similar action.  This tutorial will show you how to backup your system files and keep regular intervals. Note…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question