<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Clearing (but not deleting) log files</title>
	<atom:link href="http://www.deckerd.com/core/clearing-but-not-deleting-log-files/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.deckerd.com/core/clearing-but-not-deleting-log-files/</link>
	<description></description>
	<lastBuildDate>Tue, 13 Apr 2010 21:00:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Phil Williams</title>
		<link>http://www.deckerd.com/core/clearing-but-not-deleting-log-files/comment-page-1/#comment-1036</link>
		<dc:creator>Phil Williams</dc:creator>
		<pubDate>Mon, 12 Jan 2009 08:45:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.deckerd.com/clearing-but-not-deleting-log-files/#comment-1036</guid>
		<description>Thanks Drew.  I carried out an extensive review of the box and I&#039;m satisfied that it hadn&#039;t been compromised.

Nothing in the history stands out but I&#039;ll keep an eye on it anyway.

Oh and the commands above I posted worked fine...

Thanks again...</description>
		<content:encoded><![CDATA[<p>Thanks Drew.  I carried out an extensive review of the box and I&#8217;m satisfied that it hadn&#8217;t been compromised.</p>
<p>Nothing in the history stands out but I&#8217;ll keep an eye on it anyway.</p>
<p>Oh and the commands above I posted worked fine&#8230;</p>
<p>Thanks again&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Drew</title>
		<link>http://www.deckerd.com/core/clearing-but-not-deleting-log-files/comment-page-1/#comment-1035</link>
		<dc:creator>Drew</dc:creator>
		<pubDate>Sun, 11 Jan 2009 01:37:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.deckerd.com/clearing-but-not-deleting-log-files/#comment-1035</guid>
		<description>Phil,

None of these files really should have been changed.  The attributes of &lt;code&gt;/var/log/btmp&lt;/code&gt; should be:

&lt;code&gt;
# lsattr /var/log/btmp
------------- /var/log/btmp
&lt;/code&gt;

This also includes all other files in the &lt;code&gt;/var/log&lt;/code&gt; directory.  To answer your first question, there is not a way for me to figure this out; you could have been hacked, or it could have been an error in a custom script, including a bug.  It could have been a legit user that typed in the wrong command, too.  Things you should try first would be to check the history:

&lt;code&gt;# history &#124; less&lt;/code&gt;

This should show you a list of your whole history of the currently logged on user.  You can go through that to see if there is anything that stands out.

To answer question number two, you could enter that command to change that if you would like. Basically none of the files should have any attributes whatsoever, and they should be 600 permissions on files and 755 permissions for directories.

Let me know if you have any questions,
Drew</description>
		<content:encoded><![CDATA[<p>Phil,</p>
<p>None of these files really should have been changed.  The attributes of <code>/var/log/btmp</code> should be:</p>
<p><code><br />
# lsattr /var/log/btmp<br />
------------- /var/log/btmp<br />
</code></p>
<p>This also includes all other files in the <code>/var/log</code> directory.  To answer your first question, there is not a way for me to figure this out; you could have been hacked, or it could have been an error in a custom script, including a bug.  It could have been a legit user that typed in the wrong command, too.  Things you should try first would be to check the history:</p>
<p><code># history | less</code></p>
<p>This should show you a list of your whole history of the currently logged on user.  You can go through that to see if there is anything that stands out.</p>
<p>To answer question number two, you could enter that command to change that if you would like. Basically none of the files should have any attributes whatsoever, and they should be 600 permissions on files and 755 permissions for directories.</p>
<p>Let me know if you have any questions,<br />
Drew</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Williams</title>
		<link>http://www.deckerd.com/core/clearing-but-not-deleting-log-files/comment-page-1/#comment-1031</link>
		<dc:creator>Phil Williams</dc:creator>
		<pubDate>Wed, 07 Jan 2009 12:06:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.deckerd.com/clearing-but-not-deleting-log-files/#comment-1031</guid>
		<description>Right I think I&#039;m getting closer to this.  When I check the attributes of the file btmp for example I get:

&lt;code&gt;lsattr btmp
-----a------- btmp&lt;/code&gt;

Now on another Linux box there are no attributes set for this file. This response indicates to me that the attributes for the file only allow append right?

running &lt;code&gt;lsattr /var/log&lt;/code&gt; shows that all the following logs have the a attribute:

&lt;code&gt;lastlog
maillog
xferlog
boot
messages
cron
secure
wtmp
tty5
faillog&lt;/code&gt;

So I ran:

&lt;code&gt;chattr -a btmp&lt;/code&gt;

This cleared the attribute and then allowed me to truncate the file.  So my question(s) would be:

1) Any idea what would have caused the attributes to change as I don&#039;t recall doing it?
2) can I run &lt;code&gt;chattr -a /var/log&lt;/code&gt; to reset the attributes on all the files in the logs directory safely?

Thanks in advance, you have been a massive help :)</description>
		<content:encoded><![CDATA[<p>Right I think I&#8217;m getting closer to this.  When I check the attributes of the file btmp for example I get:</p>
<p><code>lsattr btmp<br />
-----a------- btmp</code></p>
<p>Now on another Linux box there are no attributes set for this file. This response indicates to me that the attributes for the file only allow append right?</p>
<p>running <code>lsattr /var/log</code> shows that all the following logs have the a attribute:</p>
<p><code>lastlog<br />
maillog<br />
xferlog<br />
boot<br />
messages<br />
cron<br />
secure<br />
wtmp<br />
tty5<br />
faillog</code></p>
<p>So I ran:</p>
<p><code>chattr -a btmp</code></p>
<p>This cleared the attribute and then allowed me to truncate the file.  So my question(s) would be:</p>
<p>1) Any idea what would have caused the attributes to change as I don&#8217;t recall doing it?<br />
2) can I run <code>chattr -a /var/log</code> to reset the attributes on all the files in the logs directory safely?</p>
<p>Thanks in advance, you have been a massive help :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Drew</title>
		<link>http://www.deckerd.com/core/clearing-but-not-deleting-log-files/comment-page-1/#comment-1029</link>
		<dc:creator>Drew</dc:creator>
		<pubDate>Tue, 06 Jan 2009 00:57:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.deckerd.com/clearing-but-not-deleting-log-files/#comment-1029</guid>
		<description>Phil,

No problem.  Were you able to resolve the issue?  Also, have you made sure that you weren&#039;t hacked by any chance?  Do you have a VM (Virtual Machine) that you can test on to make sure it works on another system that is as close to your production box as possible?  Let me know, I can further help you if you need me to.

Regards,
Drew</description>
		<content:encoded><![CDATA[<p>Phil,</p>
<p>No problem.  Were you able to resolve the issue?  Also, have you made sure that you weren&#8217;t hacked by any chance?  Do you have a VM (Virtual Machine) that you can test on to make sure it works on another system that is as close to your production box as possible?  Let me know, I can further help you if you need me to.</p>
<p>Regards,<br />
Drew</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Williams</title>
		<link>http://www.deckerd.com/core/clearing-but-not-deleting-log-files/comment-page-1/#comment-1028</link>
		<dc:creator>Phil Williams</dc:creator>
		<pubDate>Mon, 05 Jan 2009 13:07:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.deckerd.com/clearing-but-not-deleting-log-files/#comment-1028</guid>
		<description>That was my thought as well.  I&#039;ve got a friend looking at the system later today but thanks for your help in the mean time...</description>
		<content:encoded><![CDATA[<p>That was my thought as well.  I&#8217;ve got a friend looking at the system later today but thanks for your help in the mean time&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Drew</title>
		<link>http://www.deckerd.com/core/clearing-but-not-deleting-log-files/comment-page-1/#comment-1027</link>
		<dc:creator>Drew</dc:creator>
		<pubDate>Mon, 05 Jan 2009 13:00:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.deckerd.com/clearing-but-not-deleting-log-files/#comment-1027</guid>
		<description>Phil,

I have to head home from work - I work graveyard shift.  However, based on your findings, it appears that this is more than my command not working.  If the case is that you run &lt;code&gt;cat /dev/null &gt; /var/log/messages&lt;/code&gt;, and you get the same error, that is a permissions error with either the user or the files.  Check your user and file permissions.

Regards,
Drew</description>
		<content:encoded><![CDATA[<p>Phil,</p>
<p>I have to head home from work &#8211; I work graveyard shift.  However, based on your findings, it appears that this is more than my command not working.  If the case is that you run <code>cat /dev/null &gt; /var/log/messages</code>, and you get the same error, that is a permissions error with either the user or the files.  Check your user and file permissions.</p>
<p>Regards,<br />
Drew</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Williams</title>
		<link>http://www.deckerd.com/core/clearing-but-not-deleting-log-files/comment-page-1/#comment-1026</link>
		<dc:creator>Phil Williams</dc:creator>
		<pubDate>Mon, 05 Jan 2009 12:54:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.deckerd.com/clearing-but-not-deleting-log-files/#comment-1026</guid>
		<description>Seems to be on all of them:

cat /dev/null &gt; /var/log/maillog
-bash: /var/log/maillog: Operation not permitted
cat /dev/null &gt; /var/log/messages
-bash: /var/log/messages: Operation not permitted
cat /dev/null &gt; /var/log/secure
-bash: /var/log/secure: Operation not permitted

Perms are:
-rw-------  1 root     root  68408979 Jan  5 12:52 maillog

-rw-------  1 root     root  55888419 Jan  5 12:52 messages

-rw-------  1 root     root   2208980 Jan  5 12:52 secure</description>
		<content:encoded><![CDATA[<p>Seems to be on all of them:</p>
<p>cat /dev/null &gt; /var/log/maillog<br />
-bash: /var/log/maillog: Operation not permitted<br />
cat /dev/null &gt; /var/log/messages<br />
-bash: /var/log/messages: Operation not permitted<br />
cat /dev/null &gt; /var/log/secure<br />
-bash: /var/log/secure: Operation not permitted</p>
<p>Perms are:<br />
-rw&#8212;&#8212;-  1 root     root  68408979 Jan  5 12:52 maillog</p>
<p>-rw&#8212;&#8212;-  1 root     root  55888419 Jan  5 12:52 messages</p>
<p>-rw&#8212;&#8212;-  1 root     root   2208980 Jan  5 12:52 secure</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Drew</title>
		<link>http://www.deckerd.com/core/clearing-but-not-deleting-log-files/comment-page-1/#comment-1025</link>
		<dc:creator>Drew</dc:creator>
		<pubDate>Mon, 05 Jan 2009 12:50:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.deckerd.com/clearing-but-not-deleting-log-files/#comment-1025</guid>
		<description>Phil,

Try running it on a file other than /var/log/btmp.  That&#039;s a special file.  See if you can either create a new file and run it, or if there is a log file that you don&#039;t need right now, run it on that.  Let me know if you get the error on just the /var/log/btmp file or if it is on multiple files.  

Regards,
Drew</description>
		<content:encoded><![CDATA[<p>Phil,</p>
<p>Try running it on a file other than /var/log/btmp.  That&#8217;s a special file.  See if you can either create a new file and run it, or if there is a log file that you don&#8217;t need right now, run it on that.  Let me know if you get the error on just the /var/log/btmp file or if it is on multiple files.  </p>
<p>Regards,<br />
Drew</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Williams</title>
		<link>http://www.deckerd.com/core/clearing-but-not-deleting-log-files/comment-page-1/#comment-1024</link>
		<dc:creator>Phil Williams</dc:creator>
		<pubDate>Mon, 05 Jan 2009 12:35:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.deckerd.com/clearing-but-not-deleting-log-files/#comment-1024</guid>
		<description>Nope none at all.  I normally just login as root to execute the commands...</description>
		<content:encoded><![CDATA[<p>Nope none at all.  I normally just login as root to execute the commands&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Drew</title>
		<link>http://www.deckerd.com/core/clearing-but-not-deleting-log-files/comment-page-1/#comment-1023</link>
		<dc:creator>Drew</dc:creator>
		<pubDate>Mon, 05 Jan 2009 12:32:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.deckerd.com/clearing-but-not-deleting-log-files/#comment-1023</guid>
		<description>Phil,

What&#039;s changed?  Did you upgrade anything?  Have you made any changes to the permissions of your files or to the user running the command?

Regards,
Drew</description>
		<content:encoded><![CDATA[<p>Phil,</p>
<p>What&#8217;s changed?  Did you upgrade anything?  Have you made any changes to the permissions of your files or to the user running the command?</p>
<p>Regards,<br />
Drew</p>
]]></content:encoded>
	</item>
</channel>
</rss>
