[TriLUG] proper method to clean up utmp and wtmp?

Robert Dale robdale at gmail.com
Sat Jul 21 12:40:09 EDT 2007


On 7/21/07, Blackburn, Marvin <mblackburn at glenraven.com> wrote:
> I want to manually archive wtmp and /dev/null it out without using
> logrotate.
> What is the proper way to handle this and how should I cleanu up utmp?

backing up wtmp is like backing up any regular file.
look at the perms and ownership, recreate with the same.

cd /var/log
mv wtmp wtmp.backup
touch wtmp
chmod 0664 wtmp
chgrp utmp wtmp

if you run fedora (and probably most dists), you can mv the file and
it will automagically be recreated at boot time.

to clean up utmp, truncate it with "> /var/log/utmp"
you will lose your current login records - who,w will show noone

again, most dists do all this for you, so you could simply rm
/var/log/wtmp, reboot, and all is good.

-- 
Robert Dale



More information about the TriLUG mailing list