<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>http://birkoff.net/blog</title>
	<atom:link href="http://birkoff.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://birkoff.net/blog</link>
	<description>ps -efwww &#124; grep blog =&#62; Hector&#039;s Blog</description>
	<lastBuildDate>Tue, 15 May 2012 22:17:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Rotate Logs in Linux (with logrotate)</title>
		<link>http://birkoff.net/blog/rotate-logs-in-linux-with-logrotate/</link>
		<comments>http://birkoff.net/blog/rotate-logs-in-linux-with-logrotate/#comments</comments>
		<pubDate>Tue, 15 May 2012 22:17:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[servers]]></category>

		<guid isPermaLink="false">http://birkoff.net/blog/?p=178</guid>
		<description><![CDATA[For web servers with large numbers of transactions the logs files can grow and keep growing until become huge, some of them more than 1G so the way we can deal with this (and avoid to run out of disk space) is rotating the log files, zipping the old ones, creating new empty available files [...]]]></description>
			<content:encoded><![CDATA[<p>For web servers with large numbers of transactions the logs files can grow and keep growing until become huge, some of them more than 1G so the way we can deal with this (and avoid to run out of disk space) is rotating the log files, zipping the old ones, creating new empty available files and after some time completily delete some logs, we can easily achieve this with (logrotate)</p>
<p><strong>1. Install log rotate:</strong><br />
#&gt;<code>yum install logrotate</code></p>
<p><strong>2. Create the configuration file (refer below for the complete list of options):</strong><br />
#&gt;<code>vim /etc/logrotate.d/apache</code></p>
<pre class="wp-code-highlight prettyprint">/usr/local/apache2/logs/*log {
  size 70M
  compress
  dateext
  notifempty
  rotate 7
  missingok
  sharedscripts
  postrotate
    /etc/init.d/apachectl restart
  endscript
}</pre>
<p><strong>so basically here we are specifying the next:</strong></p>
<ul>
<li>/usr/local/apache2/logs/*log :</li>
<ul>
<li> any of the logs in &#8220;/usr/local/apache2/logs/&#8221;</li>
</ul>
<li>size 70M :</li>
<ul>
<li>The files should be rotated when goes bigger than 70M (we can specify based on time, daily, weekly, monthly)</li>
</ul>
<li>compress :</li>
<ul>
<li>Compress older files with gzip. Opposite: nocompress</li>
</ul>
<li>dateext :</li>
<ul>
<li> the date will be append in the new filename</li>
</ul>
<li>notifempty :</li>
<ul>
<li>Don&#8217;t do any rotation if the logfile is empty. Opposite: ifempty</li>
</ul>
<li>rotate 7 :</li>
<ul>
<li>We should keep no more than nn files</li>
</ul>
<li>missingok :</li>
<ul>
<li>Do not generate an error if the log is missing</li>
</ul>
<li>sharedscripts:</li>
<ul>
<li>Run any given prerotate or postrotate script for each logfile individually. Opposite: nosharedscripts.</li>
</ul>
<li>postrotate:</li>
<ul>
<li>Anything between these is executed after the rotation process. Opposite : prerotate</li>
</ul>
</ul>
<div><strong>Testing our script</strong></div>
<p><code>cd /usr/local/apache2/logs/</code></p>
<p><code>logrotate -s logstatus /etc/logrotate.d/apache</code><br />
<code>ls -lah</code><br />
<code><br />
-rw-r--r-- 1 root root 4.8K Jul 20 2011 access_log<br />
<strong>-rw-r--r-- 1 root root 8.2M May 14 22:16 access_log-20120514.gz</strong><br />
-rw-r--r-- 1 root root 0 Jul 20 2011 jsr-access_log<br />
-rw-r--r-- 1 root root 0 Jul 20 2011 jsr-error_log<br />
-rw-r--r-- 1 root root 647 May 14 22:16 logstatus<br />
-rw-r--r-- 1 root root 0 May 14 22:16 members-access_log<br />
<strong>-rw-r--r-- 1 root root 4.8M May 14 22:16 members-access_log-20120514.gz</strong><br />
-rw-r--r-- 1 root root 0 May 14 22:16 members-error_log<br />
<strong>-rw-r--r-- 1 root root 1.2M May 14 22:16 members-error_log-20120514.gz</strong><br />
</code></p>
<p>Pretty simple&#8230; isn&#8217;t it? now we&#8217;re all set!</p>
<p>&nbsp;</p>
<p><strong>List of available options:</strong></p>
<p><strong>compress: </strong>Old versions of log files are compressed with gzip by default. See also nocompress.</p>
<p>&nbsp;</p>
<p><strong>compresscmd: </strong>Specifies which command to use to compress log files. The default is <strong>gzip</strong>. See also <strong>compress</strong>.</p>
<p>&nbsp;</p>
<p><strong>uncompresscmd: </strong>Specifies which command to use to uncompress log files. The default is <strong>gunzip</strong>.</p>
<p>&nbsp;</p>
<p><strong>compressext: </strong>Specifies which extension to use on compressed logfiles, if compression is enabled. The default follows that of the configured compression command.</p>
<p>&nbsp;</p>
<p><strong>compressoptions: </strong>Command line options may be passed to the compression program, if one is in use. The default, for <strong>gzip</strong>, is &#8220;-9&#8243; (maximum compression).</p>
<p>&nbsp;</p>
<p><strong>copy: </strong>Make a copy of the log file, but don&#8217;t change the original at all. This option can be used, for instance, to make a snapshot of the current log file, or when some other utility needs to truncate or pare the file. When this option is used, the <strong>create</strong>option will have no effect, as the old log file stays in place.</p>
<p>&nbsp;</p>
<p><strong>copytruncate: </strong>Truncate the original log file in place after creating a copy, instead of moving the old log file and optionally creating a new one, It can be used when some program can not be told to close its logfile and thus might continue writing (appending) to the previous log file forever. Note that there is a very small time slice between copying the file and truncating it, so some logging data might be lost. When this option is used, the <strong>create</strong>option will have no effect, as the old log file stays in place.</p>
<p>&nbsp;</p>
<p><strong>create: </strong><em>mode</em> <em>owner</em> <em>group</em>Immediately after rotation (before the <strong>postrotate</strong> script is run) the log file is created (with the same name as the log file just rotated). <em>mode</em> specifies the mode for the log file in octal (the same as <strong><a href="http://linux.about.com/library/cmd/blcmdl2_chmod.htm">chmod</a>(2)</strong>), <em>owner</em> specifies the user name who will own the log file, and <em>group</em> specifies the group the log file will belong to. Any of the log file attributes may be omitted, in which case those attributes for the new file will use the same values as the original log file for the omitted attributes. This option can be disabled using the <strong>nocreate</strong>option.</p>
<p>&nbsp;</p>
<p><strong>daily: </strong>Log files are rotated every day.</p>
<p>&nbsp;</p>
<p><strong>delaycompress: </strong>Postpone compression of the previous log file to the next rotation cycle. This has only effect when used in combination with <strong>compress</strong>. It can be used when some program can not be told to close its logfile and thus might continue writing to the previous log file for some time.</p>
<p>&nbsp;</p>
<p><strong>extension:  </strong><em>ext</em>Log files are given the final extension <em>ext</em> after rotation. If compression is used, the compression extension (normally <strong>.gz</strong>) appears after <em>ext</em>.</p>
<p>&nbsp;</p>
<p><strong>ifempty: </strong>Rotate the log file even if it is empty, overiding the <strong>notifempty</strong>option (ifempty is the default).</p>
<p>&nbsp;</p>
<p><strong>include : </strong><em>file_or_directory</em>Reads the file given as an argument as if it was included inline where the <strong>include</strong> directive appears. If a directory is given, most of the files in that directory are read in alphabetic order before processing of the including file continues. The only files which are ignored are files which are not regular files (such as directories and named pipes) and files whose names end with one of the taboo extensions, as specified by the <strong>tabooext</strong> directive. The <strong>include</strong>directive may not appear inside of a log file definition.</p>
<p>&nbsp;</p>
<p><strong>mail </strong><em>address</em>When a log is rotated out-of-existence, it is mailed to <em>address</em>. If no mail should be generated by a particular log, the <strong>nomail</strong>directive may be used.</p>
<p>&nbsp;</p>
<p><strong>mailfirst</strong>When using the <strong>mail</strong>command, mail the just-rotated file, instead of the about-to-expire file.</p>
<p>&nbsp;</p>
<p><strong>maillast</strong>When using the <strong>mail</strong>command, mail the about-to-expire file, instead of the just-rotated file (this is the default).</p>
<p>&nbsp;</p>
<p><strong>missingok</strong>If the log file is missing, go on to the next one without issuing an error message. See also <strong>nomissingok</strong>.</p>
<p>&nbsp;</p>
<p><strong>monthly</strong>Log files are rotated the first time <strong>logrotate</strong>is run in a month (this is normally on the first day of the month).</p>
<p>&nbsp;</p>
<p><strong>nocompress</strong>Old versions of log files are not compressed with <strong>gzip</strong>. See also <strong>compress</strong>.</p>
<p>&nbsp;</p>
<p><strong>nocopy</strong>Do not copy the original log file and leave it in place. (this overrides the <strong>copy</strong>option).</p>
<p>&nbsp;</p>
<p><strong>nocopytruncate</strong>Do not truncate the original log file in place after creating a copy (this overrides the <strong>copytruncate</strong>option).</p>
<p>&nbsp;</p>
<p><strong>nocreate</strong>New log files are not created (this overrides the <strong>create</strong>option).</p>
<p>&nbsp;</p>
<p><strong>nodelaycompress</strong>Do not postpone compression of the previous log file to the next rotation cycle (this overrides the <strong>delaycompress</strong>option).</p>
<p>&nbsp;</p>
<p><strong>nomail</strong>Don&#8217;t mail old log files to any address.</p>
<p>&nbsp;</p>
<p><strong>nomissingok</strong>If a log file does not exist, issue an error. This is the default.</p>
<p>&nbsp;</p>
<p><strong>noolddir</strong>Logs are rotated in the same directory the log normally resides in (this overrides the <strong>olddir</strong>option).</p>
<p>&nbsp;</p>
<p><strong>nosharedscripts</strong>Run <strong>prerotate</strong> and <strong>postrotate</strong> scripts for every script which is rotated (this is the default, and overrides the <strong>sharedscripts</strong>option).</p>
<p>&nbsp;</p>
<p><strong>notifempty</strong>Do not rotate the log if it is empty (this overrides the <strong>ifempty</strong>option).</p>
<p>&nbsp;</p>
<p><strong>olddir </strong><em>directory</em>Logs are moved into <em>directory</em> for rotation. The <em>directory</em> must be on the same physical device as the log file being rotated. When this option is used all old versions of the log end up in <em>directory</em>. This option may be overriden by the <strong>noolddir</strong>option.</p>
<p>&nbsp;</p>
<p><strong>postrotate</strong>/<strong>endscript</strong>The lines between <strong>postrotate</strong> and <strong>endscript</strong> (both of which must appear on lines by themselves) are executed after the log file is rotated. These directives may only appear inside of a log file definition. See <strong>prerotate</strong>as well.</p>
<p>&nbsp;</p>
<p><strong>prerotate</strong>/<strong>endscript</strong>The lines between <strong>prerotate</strong> and <strong>endscript</strong> (both of which must appear on lines by themselves) are executed before the log file is rotated and only if the log will actually be rotated. These directives may only appear inside of a log file definition. See <strong>postrotate</strong>as well.</p>
<p>&nbsp;</p>
<p><strong>firstaction</strong>/<strong>endscript</strong>The lines between <strong>firstaction</strong> and <strong>endscript</strong> (both of which must appear on lines by themselves) are executed once before all log files that match the wildcarded pattern are rotated, before prerotate script is run and only if at least one log will actually be rotated. These directives may only appear inside of a log file definition. See <strong>lastaction</strong>as well.</p>
<p>&nbsp;</p>
<p><strong>lastaction</strong>/<strong>endscript</strong>The lines between <strong>lastaction</strong> and <strong>endscript</strong> (both of which must appear on lines by themselves) are executed once after all log files that match the wildcarded pattern are rotated, after postrotate script is run and only if at least one log is rotated. These directives may only appear inside of a log file definition. See <strong>lastaction</strong>as well.</p>
<p>&nbsp;</p>
<p><strong>rotate </strong><em>count</em>Log files are rotated times before being removed or mailed to the address specified in a <strong>mail</strong> directive. If <em>count</em>is 0, old versions are removed rather then rotated.</p>
<p>&nbsp;</p>
<p><strong>size </strong><em>size</em>Log files are rotated when they grow bigger then <em>size</em> bytes. If <em>size</em> is followed by <em>M</em>, the size if assumed to be in megabytes. If the <em>k</em> is used, the size is in kilobytes. So <strong>size 100</strong>, <em>size 100k</em>, and <em>size 100M</em>are all valid.</p>
<p>&nbsp;</p>
<p><strong>sharedscripts</strong>Normally, <strong>prescript</strong> and <strong>postscript</strong> scripts are run for each log which is rotated, meaning that a single script may be run multiple times for log file entries which match multiple files (such as the /var/log/news/* example). If <strong>sharedscript</strong>is specified, the scripts are only run once, no matter how many logs match the wildcarded pattern. However, if none of the logs in the pattern require rotating, the scripts will not be run at all. This option overrides the nosharedscripts option.</p>
<p>&nbsp;</p>
<p><strong>start </strong><em>count</em>This is the number to use as the base for rotation. For example, if you specify 0, the logs will be created with a .0 extension as they are rotated from the original log files. If you specify 9, log files will be created with a .9, skipping 0-8. Files will still be rotated the number of times specified with the <strong>count</strong>directive.</p>
<p>&nbsp;</p>
<p><strong>tabooext</strong> [+] <em>list</em>The current taboo extension list is changed (see the <strong>include</strong>directive for information on the taboo extensions). If a + precedes the list of extensions, the current taboo extension list is augmented, otherwise it is replaced. At startup, the taboo extension list contains .rpmorig, .rpmsave, ,v, .swp, .rpmnew, and ~.</p>
<p>&nbsp;</p>
<p><strong>weekly</strong>Log files are rotated if the current weekday is less then the weekday of the last rotation or if more then a week has passed since the last rotation. This is normally the same as rotating logs on the first day of the week, but it works better if <em>logrotate</em> is not run every night.</p>
]]></content:encoded>
			<wfw:commentRss>http://birkoff.net/blog/rotate-logs-in-linux-with-logrotate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MountESB Volume on Amazon EC2 (AMI)</title>
		<link>http://birkoff.net/blog/mountesb-volume-on-amazon-ec2-ami/</link>
		<comments>http://birkoff.net/blog/mountesb-volume-on-amazon-ec2-ami/#comments</comments>
		<pubDate>Thu, 16 Feb 2012 21:26:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://birkoff.net/blog/?p=172</guid>
		<description><![CDATA[Via the console create a volume not from a snapshot &#8211; (this won&#8217;t have a filesystem) Adding volumes to your AMI instances : Connect the volume to the specific AMI that is running via the console Then login via SSH into the and create a file system on the newly created volume and then make [...]]]></description>
			<content:encoded><![CDATA[<p>Via the console create a volume not from a snapshot &#8211; (this won&#8217;t have a filesystem)</p>
<p>Adding volumes to your AMI instances :</p>
<p>Connect the volume to the specific AMI that is running via the console</p>
<p>Then login via SSH into the and create a file system on the newly created volume and then make it available to the AMI.</p>
<p>&nbsp;</p>
<p><code>sudo mkfs.ext4 /dev/xvdf</code></p>
<p>&nbsp;</p>
<p>Then add this to the /etc/fstab</p>
<div>
<div>/dev/xvdf        /media/volume ext4    noatime 0 0</div>
</div>
<div>
<p><code><a href="http://www.php.net/mkdir">mkdir</a> /media/volume</code><br />
<code>mount /media/volume</code></p>
<p>&nbsp;</p>
<p>Check the mount :</p>
<p><code>df -h</code></p>
<p>(you should now see a new /volume_shared file system mounted on the EBS volume)<br />
<code>[root@machine volume]# df -h<br />
Filesystem            Size  Used Avail Use% Mounted on<br />
/dev/xvda1            7.9G  6.5G  1.4G  84% /<br />
tmpfs                 299M     0  299M   0% /dev/shm<br />
/dev/xvdf              30G  172M   28G   1% /media/volume</code>
</div>
]]></content:encoded>
			<wfw:commentRss>http://birkoff.net/blog/mountesb-volume-on-amazon-ec2-ami/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some Important Log Files</title>
		<link>http://birkoff.net/blog/some-important-log-files/</link>
		<comments>http://birkoff.net/blog/some-important-log-files/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 19:04:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[servers]]></category>

		<guid isPermaLink="false">http://birkoff.net/blog/?p=161</guid>
		<description><![CDATA[There are a lot of different log files in a Server (or Linux box &#8211; yeah I dont care about Win boxes) we maybe are familiarized with http log, mysql logs, syslogs, etc, but regarding security there are some really important files to look at whenever you want to get an Idea who/when/How somebody wants to get un-authorized access to [...]]]></description>
			<content:encoded><![CDATA[<p>There are a lot of different log files in a Server (or Linux box &#8211; yeah I dont care about Win boxes) we maybe are familiarized with http log, mysql logs, syslogs, etc, but regarding security there are some really important files to look at whenever you want to get an Idea who/when/How somebody wants to get un-authorized access to the server</p>
<p>&nbsp;</p>
<h2>/var/log/btmp</h2>
<p>The btmp log keeps track of failed login attempts. I have seen on a default linux setup with logrotate configured where the btmp log is left out of rotation and eventually grows out of hand. So first you want to make sure that the btmp log is rotated using logrotate with the below information.</p>
<p>&nbsp;</p>
<p><strong>How to Read btmp Log</strong></p>
<p>last -f /var/log/btmp</p>
<div id="highlighter_354102">
<div><span style="font-size: small;"><span style="line-height: normal;"><br />
</span></span></div>
</div>
<div><strong>Example btmp Entries (Look at those mf&#8217;ers):</strong></div>
<div>
<blockquote><p>admin    ssh:notty    122.70.144.206   Sun Feb 12 07:43    gone &#8211; no logout</p>
<p>admin    ssh:notty    122.70.144.206   Sun Feb 12 07:43 &#8211; 07:43  (00:00)</p>
<p>admin    ssh:notty    122.70.144.206   Sun Feb 12 07:43 &#8211; 07:43  (00:00)</p>
<p>admin    ssh:notty    122.70.144.206   Sun Feb 12 07:43 &#8211; 07:43  (00:00)</p>
<p>adi      ssh:notty    122.70.144.206   Sun Feb 12 07:42 &#8211; 07:43  (00:00)</p>
<p>abc      ssh:notty    122.70.144.206   Sun Feb 12 07:42 &#8211; 07:42  (00:00)</p>
<p>abc      ssh:notty    122.70.144.206   Sun Feb 12 07:42 &#8211; 07:42  (00:00)</p>
<p>toor     ssh:notty    www12198uc.sakur Sat Feb 11 22:02 &#8211; 07:42  (09:40)</p>
<p>sam      ssh:notty    189.1.162.182    Thu Feb  9 18:27 &#8211; 22:02 (2+03:34)</p>
<p>pgsql    ssh:notty    189.1.162.182    Thu Feb  9 18:27 &#8211; 18:27  (00:00)</p>
<p>webmaste ssh:notty    189.1.162.182    Thu Feb  9 18:27 &#8211; 18:27  (00:00)</p>
<p>master   ssh:notty    189.1.162.182    Thu Feb  9 18:27 &#8211; 18:27  (00:00)</p>
<p>james    ssh:notty    189.1.162.182    Thu Feb  9 18:27 &#8211; 18:27  (00:00)</p>
<p>library  ssh:notty    189.1.162.182    Thu Feb  9 18:27 &#8211; 18:27  (00:00)</p>
<p>data     ssh:notty    189.1.162.182    Thu Feb  9 18:27 &#8211; 18:27  (00:00)</p>
<p>http     ssh:notty    189.1.162.182    Thu Feb  9 18:27 &#8211; 18:27  (00:00)</p>
<p>ssh      ssh:notty    189.1.162.182    Thu Feb  9 18:27 &#8211; 18:27  (00:00)</p>
<p>info     ssh:notty    189.1.162.182    Thu Feb  9 18:27 &#8211; 18:27  (00:00)</p>
<p>sales    ssh:notty    189.1.162.182    Thu Feb  9 18:27 &#8211; 18:27  (00:00)</p>
<p>samba    ssh:notty    189.1.162.182    Thu Feb  9 18:27 &#8211; 18:27  (00:00)</p>
<p>tomcat   ssh:notty    189.1.162.182    Thu Feb  9 18:27 &#8211; 18:27  (00:00)</p>
<p>jabber   ssh:notty    189.1.162.182    Thu Feb  9 18:27 &#8211; 18:27  (00:00)</p>
<p>wwwuser  ssh:notty    189.1.162.182    Thu Feb  9 18:27 &#8211; 18:27  (00:00)</p></blockquote>
<p>&nbsp;</p>
<p>As you can see the (mf&#8217;er) 122.70.144.206 and  189.1.162.182  addresses are running some type of brute force against this server in an attempt to gain access. Now you could add this IP address to your iptables or other firewall to defend against such an attack.</p>
<p><strong>Show the top 10 IPs with failed logins (first column is failed # of tries, then 2nd column is the IP)</strong></p>
<p><code>lastb | awk </code><code>'{print $3}'</code> <code>| sort | uniq -c | sort -rn | head -10</code></p>
<div>
<div id="highlighter_715666">
<div><strong>Show the top 10 usernames with failed logins</strong></div>
<div><code>lastb | awk </code><code>'{print $1}'</code> <code>| sort | uniq -c | sort -rn | head -10</code></div>
</div>
</div>
</div>
<div>
<h2>/var/log/secure</h2>
<p>&nbsp;</p>
<p><strong>How to Read secure Log</strong></p>
<p><code>tail /var/log/secure</code></p>
<p>&nbsp;</p>
<div><strong>Example <strong>secure</strong> Entries (Look at those mf&#8217;ers):</strong></div>
<blockquote>
<div>Feb 12 04:50:35 team sshd[6789]: Did not receive identification string from 122.70.144.206</div>
<p>Feb 12 07:42:42 team sshd[20436]: reverse mapping checking getaddrinfo for ip144.hichina.com [122.70.144.206] failed &#8211; POSSIBLE BREAK-IN ATTEMPT!</p>
<p>Feb 12 07:42:42 team sshd[20436]: Invalid user abc from 122.70.144.206</p>
<p>Feb 12 07:42:42 team sshd[20437]: input_userauth_request: invalid user abc</p>
<p>Feb 12 07:42:42 team sshd[20437]: Received disconnect from 122.70.144.206: 11: Bye Bye</p>
<p>Feb 12 07:42:44 team sshd[20438]: reverse mapping checking getaddrinfo for ip144.hichina.com [122.70.144.206] failed &#8211; POSSIBLE BREAK-IN ATTEMPT!</p>
<p>Feb 12 07:42:44 team sshd[20438]: Invalid user abc from 122.70.144.206</p>
<p>Feb 12 07:42:44 team sshd[20439]: input_userauth_request: invalid user abc</p>
<p>Feb 12 07:42:44 team sshd[20439]: Received disconnect from 122.70.144.206: 11: Bye Bye</p>
<p>Feb 12 07:42:47 team sshd[20440]: reverse mapping checking getaddrinfo for ip144.hichina.com [122.70.144.206] failed &#8211; POSSIBLE BREAK-IN ATTEMPT!</p>
<p>Feb 12 07:42:47 team sshd[20440]: Invalid user adi from 122.70.144.206</p>
<p>Feb 12 07:42:47 team sshd[20441]: input_userauth_request: invalid user adi</p>
<p>Feb 12 07:42:47 team sshd[20441]: Received disconnect from 122.70.144.206: 11: Bye Bye</p>
<p>&nbsp;</p></blockquote>
</div>
<h2>/var/log/wtmp</h2>
<p>The wtmp file records all logins and logouts history</p>
<p>&nbsp;</p>
<p><strong>How to Read wtmp Log</strong></p>
<p><code>last -f /var/log/wtmp</code></p>
<p>&nbsp;</p>
<div><strong>Example <strong><strong>wtmp</strong></strong> Entries :</strong></div>
<div><strong><br />
</strong></div>
<blockquote><p>root pts/1 233-14-150-49-ne Tue Feb 14 17:54 still logged in<br />
root pts/0 233-14-150-49-ne Tue Feb 14 16:00 still logged in<br />
root pts/0 233-14-150-49-ne Mon Feb 13 19:58 &#8211; 23:33 (03:34)<br />
root pts/0 233-14-150-49-ne Wed Feb 8 22:21 &#8211; 02:23 (04:02)<br />
root pts/0 233-14-150-49-ne Wed Feb 8 22:19 &#8211; 22:19 (00:00)<br />
root pts/0 233-14-150-49-ne Wed Jan 25 17:05 &#8211; 23:24 (06:19)<br />
root pts/0 233-14-150-49-ne Thu Jan 19 20:23 &#8211; 23:22 (02:58)</p>
<p>&nbsp;</p></blockquote>
<p><strong>To review recent logins. If the login is from a remote location, it will be associated with a specific IPaddress</strong></p>
<p>&nbsp;</p>
<p><code>utmpdump /var/log/wtmp | less</code></p>
]]></content:encoded>
			<wfw:commentRss>http://birkoff.net/blog/some-important-log-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>“El Conde de Montecristo” – Alejandro Dumas</title>
		<link>http://birkoff.net/blog/%e2%80%9cel-conde-de-montecristo%e2%80%9d-%e2%80%93-alejandro-dumas/</link>
		<comments>http://birkoff.net/blog/%e2%80%9cel-conde-de-montecristo%e2%80%9d-%e2%80%93-alejandro-dumas/#comments</comments>
		<pubDate>Sun, 29 Jan 2012 19:45:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://birkoff.net/blog/?p=156</guid>
		<description><![CDATA[-Nunca se está en paz con los que nos hacen un favor, porque aunque se pague el dinero, se debe la gratitud. -Para calzarse la capitanía hay que lisonjear un tanto a los patrones. -¡Borracho!, eso me gusta; ¡ay de los que no gustan del vino!, tienen algún mal pensamiento, y temen que el vino [...]]]></description>
			<content:encoded><![CDATA[<p>-Nunca se está en paz con los que nos hacen un favor, porque aunque se pague el dinero, se debe la gratitud.</p>
<p>-Para calzarse la capitanía hay que lisonjear un tanto a los patrones.</p>
<p>-¡Borracho!, eso me gusta; ¡ay de los que no gustan del vino!, tienen algún mal pensamiento, y temen que el vino se lo haga revelar.</p>
<p>-Los franceses tienen sobre los españoles la ventaja de que los españoles piensan y los franceses improvisan.</p>
<p>-El corazón de la mujer es de tal naturaleza que aunque árido y endurecido por las exigencias sociales, siempre guarda un rincón fértil y amable, el que Dios ha consagrado al amor de madre.</p>
<p>-hablad y, sobre todo, comenzad por el principio, porque me gusta el orden en todas las cosas. -Señor</p>
<p>-los reyes de ahora, encerrados en los límites de lo probable, no tienen la audacia de la voluntad, temen el oído que escucha las órdenes que ellos mismos dan, el ojo que ve sus acciones; no sienten en sí lo superior de la esencia divina, son hombres coronados, en una palabra.</p>
<p>-En otro tiempo se creían o a lo menos se decían hijos de Júpiter, y conservaban algo del ser de su padre; que no se plagian fácilmente las cosas de ultra-nubes. Ahora los reyes se hacen muy a menudo vulgares.</p>
<p>-Dantés no conocía más que su pasado, tan breve; su presente, tan sombrío, y su futuro tan dudoso.</p>
<p>-devorándolo como el implacable Ugolino devora el cráneo del arzobispo Roger en el Infierno del Dante.</p>
<p>-Aprender no es saber, de aquí nacen los eruditos y los sabios, la memoria forma a los unos, y la filosofía a los otros.</p>
<p>-La filosofía no se aprende. La filosofía es el matrimonio entre las ciencias y el genio que las aplica. La filosofía es la nube resplandeciente en que puso Dios el pie para subir a la gloria.</p>
<p>-Desengañaos&#8230;, sufro menos porque tengo menos fuerzas para sufrir.</p>
<p>-Sed sabio como Néstor, y astuto como Ulises.</p>
<p>-Cucumetto había violado a tu hija -dijo el bandido-, y como yo la amaba más que a mí mismo, la he matado, porque después de él iba a servir de juguete a toda la compañía. »Los labios del anciano no se entreabrieron para murmurar la más mínima palabra, pero su rostro volvióse tan pálido como el de un cadáver. »-Ahora -prosiguió Carlini-, si he hecho mal, véngala. »Y arrancó el cuchillo del seno de la joven, que presentó con una mano al anciano, mientras que con la otra apartaba su camisa y le presentaba su pecho desnudo. »-Has hecho bien -le dijo el anciano con voz sorda-. ¡Abrázame, hijo mío!</p>
<p>-tavolette son unas tabletas de madera que se cuelgan en todas las esquinas de las calles la víspera de las ejecuciones, y en las cuales están escritos los nombres de los condenados, la causa de su condenación y la clase de suplicio. Tienen por objeto invitar a los fieles a que rueguen a Dios para que dé a los culpables un sincero arrepentimiento.</p>
<p>-saliera por la puerta del Popolo, que diese la vuelta por el lado exterior de las murallas y que entrase por la puerta de San Juan</p>
<p>-todo su ser parecía obedecer a un movimiento maquinal en el cual no entraba ya para nada su voluntad.</p>
<p>-no os detengo, caballero -dijo la condesa-, porque no quiero que mi reconocimiento sea indiscreción.</p>
<p>-le miraría como a uno de los personajes de Byron, a quienes la desgracia ha marcado con un sello fatal. Algún Manfredo, algún Lara, algún Werner, como uno de esos restos, en fin, de alguna familia antigua que, desheredados de su fortuna paterna, han encontrado una por la fuerza de su genio aventurero, que les ha hecho superiores a las leyes de la sociedad.</p>
<p>-los malos no mueren así, porque Dios parece protegerlos para hacerlos instrumentos de sus venganzas.</p>
<p>-mis peones de México habrán descubierto alguna mina.</p>
<p>-Patros men aten, ma de onoma prodotu kai prodosiam, eipe emin.</p>
<p>-La vida es tan incierta, que la felicidad debe aprovecharse en el momento en que se presenta.</p>
<p>-Cuando vendiste a tu amigo, empezó Dios, no por castigarte, sino por advertirte. Caíste en la miseria y tuviste hambre, pasaste la mitad de tu vida codiciando lo que hubieras podido adquirir, y ya pensabas en el crimen, dándote a ti mismo la disculpa de la necesidad, cuando Dios obró un milagro, cuando Dios te envió por mi mano, cuando más miserable estabas, una fortuna inmensa para ti, que nada habías poseído. Pero esta fortuna inesperada e inaudita te parece insuficiente desde el momento en que empiezas a poseerla. Quieres doblarla. ¿Y por qué medio? Por el del asesinato. La doblas, pero Dios te la arranca, conduciéndote ante la justicia humana.</p>
<p>-¡Ah!, no crees en Dios, y Dios, que sólo exige una súplica, una palabra, una lágrima para perdonar&#8230; Dios, que podía dirigir el puñal del asesino de modo que expirases en el acto&#8230;, te concedió un cuarto de hora para arrepentirte&#8230; ¡Vuelve en ti, desventurado, y arrepiéntete!</p>
<p>-¡habré trabajado para ser mañana un poco de polvo! No siendo la muerte del cuerpo, esta destrucción del principio vital ¿no es el reposo al cual todos los desgraciados aspiran? Esa tranquilidad de la materia tras la que he suspirado tanto tiempo y a la que me encaminaba por medio del hambre</p>
<p>-¿Qué es la muerte para mí? Uno o dos grados más en el silencio. No, no es la existencia la que lamento perder, es la ruina</p>
<p>-Montecristo imprimió en aquella frente pura y hermosa un beso que hizo latir dos corazones a la vez; el uno con violencia, y el otro sordamente</p>
<p>-Obedeceré si me mandáis que levante la losa que cubre a la hija de Jairo. Caminaré sobre las ondas como el apóstol, si me hacéis señal con la mano de caminar sobre ellas, obedeceré en todo&#8230;</p>
<p>-Un hombre del temple del conde de Montecristo no podía estar mucho tiempo sumergido en la melancolía que suele reinar en las almas vulgares, dándoles una originalidad aparente, pero que aniquila las almas superiores.</p>
<p>-¡Cómo!, ¡una hora bastaría para probar al arquitecto que la obra de todas sus esperanzas era, si no imposible, al menos sacrílega!</p>
<p>-hasta el día en que Dios se digne descifrar el porvenir al hombre, toda la sabiduría humana estará resumida en dos palabras: ¡Confiar y esperar!</p>
<p>&nbsp;</p>
<pre class="wp-code-highlight prettyprint"></pre>
]]></content:encoded>
			<wfw:commentRss>http://birkoff.net/blog/%e2%80%9cel-conde-de-montecristo%e2%80%9d-%e2%80%93-alejandro-dumas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alternative PHP Cache (APC)</title>
		<link>http://birkoff.net/blog/alternative-php-cache-apc/</link>
		<comments>http://birkoff.net/blog/alternative-php-cache-apc/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 20:21:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[servers]]></category>

		<guid isPermaLink="false">http://birkoff.net/blog/?p=53</guid>
		<description><![CDATA[The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. Its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code. It suppose to significantly speed up your PHP applications. Q:But how APC does that magic? A:well the workflow of any php page is: [...]]]></description>
			<content:encoded><![CDATA[<p>The Alternative PHP Cache (APC) is a free and open opcode cache for PHP. Its goal is to provide a free, open, and robust framework for caching and optimizing PHP intermediate code.<br />
It suppose to significantly speed up your PHP applications.</p>
<p>Q:But how APC does that magic?<br />
A:well the workflow of any php page is:<br />
Whenever a client requests a PHP page, the server will read in the source code of the page, compile it into bytecode and then execute it.</p>
<p>Q:Haaaa so where APC takes action there?<br />
A: APC caches the compiled output of each PHP script run and reuses it for subsequent requests. This reduces the time and processing cycles needed to fully satisfy each request, leading to better performance and lower response times.</p>
<p>Q:Awesome!!! I want it&#8230; How can I install it?</p>
<p>A:Installation (with PECL):<br />
APC is a PECL extension and is not bundled with PHP</p>
<p><code>pecl install apc-3.1.9</code></p>
<p>Q:But wait&#8230; pecl?<br />
A:really? Do I need to explain this?<br />
<code>yum install php-pear </code><br />
<code>apt-get install php5-pear</code></p>
<p>Q:sorry!</p>
<p>Installation like real Macho Men:</p>
<p><code>wget http://pecl.php.net/get/APC-3.1.9.tgz<br />
tar -xvzf APC-3.1.9.tgz<br />
cd APC-3.1.9<br />
phpize<br />
locate php-config<br />
./configure --with-php-config=/usr/local/php/bin/php-config --enable-apc<br />
make<br />
make install</code></p>
<p>Tthis is the Output:<br />
<code>Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20050922/<br />
Installing header files: /usr/local/include/php/<br />
Libraries have been installed in: /opt/apc/APC-3.1.9/modules</code></p>
<p>Probably you will need to copy the module where php can read it:<br />
<code>cp modules/apc.so /usr/lib/php/modules/</code></p>
<p>Ok now edit the &#8220;php.ini&#8221; file and add the module</p>
<p><code>vim /etc/php.ini</code></p>
<p>Suggested Configuration (in your php.ini file)<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
extension=apc.so<br />
apc.enabled=1<br />
apc.shm_size=128M<br />
apc.ttl=7200<br />
apc.user_ttl=7200<br />
apc.enable_cli=1</p>
<p>/etc/init.d/apachectl restart</p>
<p>Q: got it&#8230; ok it&#8217;s done&#8230; but how can I know it worked?<br />
A: create a page in your document root with this: <!--?php phpinfo(); ?--><br />
and name it: phpinfo.php</p>
<p>then open it in a web browser (Please not IE) and look for APC you should have something like this:<br />
<a href="http://birkoff.net/blog/wp-content/uploads/2011/10/Screen-Shot-2011-10-27-at-6.09.34-PM.png"><img class="aligncenter size-medium wp-image-140" title="Screen Shot 2011-10-27 at 6.09.34 PM" src="http://birkoff.net/blog/wp-content/uploads/2011/10/Screen-Shot-2011-10-27-at-6.09.34-PM-228x300.png" alt="" width="228" height="300" /></a></p>
<p>Q: Ok is installed now what?<br />
A: Well that&#8217;s it APC will be catching the compiled output of php, there is a web page you can use (apc.php) in the source code just copy and past it in your www directory and you can see some metrics there, if you need more info you can check this site: <a href="http://devzone.zend.com/article/12618">http://devzone.zend.com/article/12618</a></p>
<p>Q: AWESOME YOU ROCK!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://birkoff.net/blog/alternative-php-cache-apc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ab &#8211; Apache HTTP server benchmarking tool</title>
		<link>http://birkoff.net/blog/ab-apache-http-server-benchmarking-tool/</link>
		<comments>http://birkoff.net/blog/ab-apache-http-server-benchmarking-tool/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 21:15:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[servers]]></category>

		<guid isPermaLink="false">http://birkoff.net/blog/?p=125</guid>
		<description><![CDATA[ab is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current Apache installation performs. This especially shows you how many requests per second your Apache installation is capable of serving. ab -n 1000 -c 5 http://example.com/test.php -n requests: Number of requests [...]]]></description>
			<content:encoded><![CDATA[<p>ab is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current Apache installation performs. This especially shows you how many requests per second your Apache installation is capable of serving.</p>
<p><code>ab -n 1000 -c 5 http://example.com/test.php</code></p>
<p>-n requests: Number of requests to perform for the benchmarking session. The default is to just perform a single request which usually leads to non-representative benchmarking results.</p>
<p>-c concurrency: Number of multiple requests to perform at a time. Default is one request at a time.</p>
<p>Here is the output of the command:</p>
<p><code>This is ApacheBench, Version 2.3<br />
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br />
Licensed to The Apache Software Foundation, http://www.apache.org/</code></p>
<p>Benchmarking example.com (be patient)<br />
Completed 100 requests<br />
Completed 200 requests<br />
Completed 300 requests<br />
Completed 400 requests<br />
Completed 500 requests<br />
Completed 600 requests<br />
Completed 700 requests<br />
Completed 800 requests<br />
Completed 900 requests<br />
Completed 1000 requests<br />
Finished 1000 requests</p>
<p>Server Software: Apache/2.2.19<br />
Server Hostname: example.com<br />
Server Port: 80</p>
<p>Document Path: /test.php<br />
Document Length: 2978 bytes</p>
<p>Concurrency Level: 5<br />
Time taken for tests: 222.898 seconds<br />
Complete requests: 1000<br />
Failed requests: 0<br />
Write errors: 0<br />
Total transferred: 3485000 bytes<br />
HTML transferred: 2978000 bytes<br />
Requests per second: 4.49 [#/sec] (mean)<br />
Time per request: 1114.488 [ms] (mean)<br />
Time per request: 222.898 [ms] (mean, across all concurrent requests)<br />
Transfer rate: 15.27 [Kbytes/sec] received</p>
<p>Connection Times (ms)<br />
min mean[+/-sd] median max<br />
Connect: 30 912 538.0 889 6864<br />
Processing: 0 198 240.2 108 1008<br />
Waiting: 0 191 240.9 100 1008<br />
Total: 664 1110 456.0 1018 6864</p>
<p>Percentage of the requests served within a certain time (ms)<br />
50% 1018<br />
66% 1082<br />
75% 1125<br />
80% 1156<br />
90% 1303<br />
95% 2067<br />
98% 2424<br />
99% 2899<br />
100% 6864 (longest request)</p>
<p>The main numbers to look at here are the requests per second and the average time per request. The lower the average time per request, the better the performance. Similarly, the greater the number of requests served, the better the performance.</p>
<p>If you want to know more about ab follow this link: <a href="http://httpd.apache.org/docs/2.0/programs/ab.html">http://httpd.apache.org/docs/2.0/programs/ab.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://birkoff.net/blog/ab-apache-http-server-benchmarking-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Highlight&#8217;s from &#8220;Cain&#8221; &#8211; Jose Saramago</title>
		<link>http://birkoff.net/blog/highlights-from-cain-jose-saramago/</link>
		<comments>http://birkoff.net/blog/highlights-from-cain-jose-saramago/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 06:48:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[books]]></category>

		<guid isPermaLink="false">http://birkoff.net/blog/?p=101</guid>
		<description><![CDATA[A couple of days ago I finished reading this book &#8220;Cain&#8221; written by Jose Saramago and personally has become one of my favorites,here are some very interesting Highlight&#8217;s from the book I want to share (relogious people won&#8217;t find this very atractive&#8230;) I killed one brother and the lord punished me, who, I would like [...]]]></description>
			<content:encoded><![CDATA[<p><strong>A couple of days ago I finished reading this book &#8220;Cain&#8221; written by Jose Saramago and personally has become one of my favorites,here are some very interesting Highlight&#8217;s from the book I want to share (relogious people won&#8217;t find this very atractive&#8230;)</p>
<blockquote><p>I killed one brother and the lord punished me, who, I would like to know, is going to punish the lord for all these deaths, thought cain,</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Locations 965-966). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>lucifer was quite right when he rebelled against god, and those who say he did so out of envy are wrong, he simply recognized god&#8217;s evil nature.</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Locations 966-967). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>he simply recognized god&#8217;s evil nature.</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Locations 966-967). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>this lord will one day be known as the god of war, I can see no other use for him, thought cain, and he was right.</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Locations 1025-1026). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>CAIN HAS NO idea where he is, he can&#8217;t tell if the donkey is taking him along one of the many roads of the past or along some narrow track in the future, or if, quite simply, he is trotting through some new present that has not, as yet, revealed itself.</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Locations 1158-1160). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>Then cain told lilith about the man called abraham whom the lord had commanded to sacrifice his own son, then about a great tower built by men who hoped to reach the sky and how the lord had razed it to the ground with a hurricane, then about the city where the men preferred to go to bed with other men and about the punishment of fire and brimstone that the lord caused to fall on them, with no thought for the children, who didn&#8217;t even know what they might wish for in the future, and then about the vast throng of people at the foot of a mountain called sinai and the making of a golden calf, which those people worshipped and were slain for doing so, about the city that dared to kill thirty-six soldiers belonging to an army known as the israelites and whose population was wiped out down to the last child, and about another city, called jericho, whose walls were demolished by the blast from some trumpets made of rams&#8217; horns and then how everything inside it was destroyed, men and women, young and old, even oxen, sheep and asses.</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Locations 1216-1223). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>Contrary to popular belief, the future is already written, it&#8217;s just that we don&#8217;t know how to read the page it&#8217;s written on,</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Locations 1224-1225). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>I have learned one thing, What&#8217;s that, That our god, the creator of heaven and earth, is completely mad,</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Locations 1226-1227). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>God could never be evil, if he was, he wouldn&#8217;t be god, evil is what the devil is for, It can&#8217;t be right for a god to order a father to kill his own son and burn him on a pyre simply as a test of faith, not even the wickedest of devils would order someone to do that,</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Locations 1229-1231). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>Cain may be a murderer, but he&#8217;s an essentially honest man,</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Location 1376). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>I repent ever having created man, for he has grieved me to the heart,</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Location 1446). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>I will destroy them along with the earth,</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Location 1447). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>you shall bring two of every sort into the ark to keep them alive with you, male and female,</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Location 1453). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>from the point of view of the worker angels, happiness on earth was far superior to that in heaven, but the lord, of course, being a jealous god, must never know this,</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Locations 1505-1506). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>in our honest opinion as angels, and considering all the evidence, we don&#8217;t believe that human beings deserve life,</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Locations 1513-1514). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>where did the strange idea come from, that god, simply because he is god, has the right to govern the private lives of his believers, setting up rules, prohibitions, interdictions and other such nonsense,</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Locations 1524-1525). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>let&#8217;s start right away, said cain, send her to the cubicle where I sleep and tell the others not to disturb us, regardless of what happens or what noises you may hear, Certainly, and may the lord&#8217;s will be done, Amen to that.</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Locations 1621-1623). Houghton Mifflin Harcourt. Kindle Edition.</p>
<blockquote><p>his latest victims are, as was abel in the past, merely further attempts on his part to kill god.</p></blockquote>
<p>Saramago, Jose (2011). Cain (Kindle Location 1625). Houghton Mifflin Harcourt. Kindle Edition.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://birkoff.net/blog/highlights-from-cain-jose-saramago/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compress and uncompress files in Linux</title>
		<link>http://birkoff.net/blog/compress-and-uncompress-files-in-linux/</link>
		<comments>http://birkoff.net/blog/compress-and-uncompress-files-in-linux/#comments</comments>
		<pubDate>Sun, 23 Oct 2011 00:49:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://birkoff.net/blog/?p=60</guid>
		<description><![CDATA[Zip Files zip archivefile1 doc1 doc2 doc3 This command creates a file &#8220;archivefile1.zip&#8221; which contains a copy of the files doc1, doc2, and doc3, located in the current directory. zip -r archivefile2 papers This copies the directory &#8220;papers&#8221;, located in the current directory, into &#8220;archivefile2.zip&#8221;. zip -r archivefile3 /home/joe/papers This copies the directory &#8220;/home/joe/papers&#8221; into [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Zip Files</strong><br />
<code>zip archivefile1 doc1 doc2 doc3</code><br />
This command creates a file &#8220;archivefile1.zip&#8221; which contains a copy of the files doc1, doc2, and doc3, located in the current directory.</p>
<p><code>zip -r archivefile2 papers</code><br />
This copies the directory &#8220;papers&#8221;, located in the current directory, into &#8220;archivefile2.zip&#8221;.</p>
<p><code> zip -r archivefile3 /home/joe/papers</code><br />
This copies the directory &#8220;/home/joe/papers&#8221; into &#8220;archivefile3.zip&#8221;. Since in this case the absolute path is given, it doesn&#8217;t matter what the current directory is, except that the zip file will be created there.</p>
<p><strong>Unzip Files</strong><br />
<code>unzip archivefile1.zip</code><br />
This writes the files extracted from &#8220;archivefile1.zip&#8221; to the current directory.</p>
<p><strong>TAR Files </strong></p>
<p>The GNU tar is archiving utility but it can be use to compressing large file(s). GNU tar supports both archive compressing through gzip and bzip2. If you have more than 2 files then it is recommended to use tar instead of gzip or bzip2.<br />
<strong>-z</strong>: use gzip compress<br />
<strong>-j</strong>: use bzip2 compress</p>
<p>.tar basically merges multiple files as a single file &#8211; there is no compression, but it captures all linux permission settings, etc.</p>
<p>.gz/bz2 provides compression. It can take single or multiple files, but it does not capture permission settings.</p>
<p><strong>To compress a diectory or files with tar.gz</strong><br />
<code>tar -czfv file.tar.gz files/</code></p>
<p><strong>To extract archives from a file.tar.gz</strong><br />
<code>tar -xvzf file.tar.gz</code></p>
<p><strong>To compress diectory or files with bz2</strong><br />
<code>tar -jcvf file.tar.bz2 files/</code></p>
<p><strong>To extract files compressed with bz2</strong><br />
<code>tar -jxvf file.tar.bz2</code></p>
]]></content:encoded>
			<wfw:commentRss>http://birkoff.net/blog/compress-and-uncompress-files-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Users to Sudoers</title>
		<link>http://birkoff.net/blog/add-users-to-sudoers/</link>
		<comments>http://birkoff.net/blog/add-users-to-sudoers/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 19:49:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://birkoff.net/blog/?p=44</guid>
		<description><![CDATA[Easy way to add users to sudoers file and give them super powers with &#8220;sudo&#8221;: echo 'loginname ALL=(ALL) ALL' >> /etc/sudoers If you dont want to be asked for your password: echo 'loginname ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers So&#8230; [birkoff@hector ~]$ su Password: [root@hector birkoff]# chmod +w /etc/sudoers [root@hector birkoff]# echo 'birkoff ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers [...]]]></description>
			<content:encoded><![CDATA[<p>Easy way to add users to sudoers file and give them super powers with &#8220;sudo&#8221;:<br />
<code><br />
echo 'loginname ALL=(ALL) ALL' >> /etc/sudoers<br />
</code></p>
<p>If you dont want to be asked for your password:<br />
<code><br />
echo 'loginname ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers<br />
</code></p>
<p>So&#8230;<br />
<code><br />
[birkoff@hector ~]$ su<br />
Password:</p>
<p>[root@hector birkoff]# chmod +w /etc/sudoers<br />
[root@hector birkoff]# echo 'birkoff ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers<br />
[root@hector birkoff]# chmod -w /etc/sudoers<br />
[root@hector birkoff]# exit<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://birkoff.net/blog/add-users-to-sudoers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automating Synchronization of directories in Linux and Amazon s3</title>
		<link>http://birkoff.net/blog/automating-synchronization-of-directories-in-linux-and-amazon-s3/</link>
		<comments>http://birkoff.net/blog/automating-synchronization-of-directories-in-linux-and-amazon-s3/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 13:56:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://birkoff.net/?p=21</guid>
		<description><![CDATA[Lets suppouse you have some directories with big amount of data, but really huge data, can be images, media, etc, and it keeps increasing size, you just discover you&#8217;re running out of space in the server so what todo?? Amazon S3 is a service allowing to store and access files at very low cost. It [...]]]></description>
			<content:encoded><![CDATA[<p>Lets suppouse you have some directories with big amount of data, but really huge data, can be images, media, etc, and it keeps increasing size, you just discover you&#8217;re running out of space in the server so what todo?? </p>
<p>Amazon S3 is a service allowing to store and access files at very low cost. It is a viable option as a remote backup server and using the extremely handy s3sync the heavy lifting work has already been done for you. First you&#8217;ll need an Amazon S3 account. Once you have that in place to set things up you&#8217;ll need your access key ID and your secret access key. To find these go to Your Web Services Account and choose AWS Access Identifiers.<br />
On your server</p>
<p>To use s3sync you need ruby to be installed. I found openssl was already installed on my server but you may need to get that too if you want to use ssl connections (you can use yum for this too).</p>
<p>To get ruby use yum (oh yeah baby red-had based distro centos or fedora):</p>
<pre class="wp-code-highlight prettyprint">
yum install ruby
</pre>
<p>Once has installed check the version using</p>
<pre class="wp-code-highlight prettyprint">
ruby -v
</pre>
<p>You should see something like</p>
<pre class="wp-code-highlight prettyprint">
ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-linux]
</pre>
<p>Download and extract s3sync and then removing the download:</p>
<pre class="wp-code-highlight prettyprint">
wget http://s3.amazonaws.com/ServEdge_pub/s3sync/s3sync.tar.gz
tar xzf s3sync.tar.gz
rm s3sync.tar.gz
</pre>
<p>Now you&#8217;ll need to set up the configuration with the access keys you have from s3</p>
<pre class="wp-code-highlight prettyprint">
cd s3sync
</pre>
<p># Copy the default configuration to the right location in /etc<br />
# You may need to be root for this</p>
<pre class="wp-code-highlight prettyprint">
mkdir /etc/s3conf
cp s3config.yml.example /etc/s3conf/s3config.yml
</pre>
<p># Edit the file </p>
<pre class="wp-code-highlight prettyprint">
vi /etc/s3conf/s3config.yml
</pre>
<p># Edit the file with the following lines</p>
<pre class="wp-code-highlight prettyprint">
aws_access_key_id: ------Your Access Key here ------
aws_secret_access_key: ---- Your Secret Access Key here ------
ssl_cert_dir: /home/your-user/s3sync/certs
</pre>
<p># Now we need to set up the SSL certificates so we can connect on a secure connection.</p>
<pre class="wp-code-highlight prettyprint">
mkdir /home/your-user/s3sync/certs
cd /home/your-user/s3sync/certs
wget http://mirbsd.mirsolutions.de/cvs.cgi/~checkout~/src/etc/ssl.certs.shar
</pre>
<p># Run the script</p>
<pre class="wp-code-highlight prettyprint">
sh ssl.certs.shar
</pre>
<p>Connecting to S3<br />
You should be set up now to access S3. There are two scripts you can use to administer and set up your backups. Both s3sync and s3cmd are well documented at s3sync but I will take you through a basic setup.</p>
<p>First we are going to set up a bucket for this server (as we may wish to back up others in the future).</p>
<pre class="wp-code-highlight prettyprint">
cd /home/your-user/s3sync
</pre>
<p># Create the bucket (add -s to use ssl)</p>
<pre class="wp-code-highlight prettyprint">
ruby s3cmd.rb createbucket birkoff_content
</pre>
<p>For this backup I&#8217;m going to backup my media directory. Here&#8217;s the command I use (I&#8217;m still in /home/your-user/s3sync).</p>
<pre class="wp-code-highlight prettyprint">
ruby s3sync.rb -r -s -v --exclude=&quot;cache$|captchas$&quot; --delete /data/media/ birkoff_content:media &gt; /var/log/s3sync
</pre>
<p>Let&#8217;s go through the options</p>
<pre class="wp-code-highlight prettyprint">
-r
    This tells the script to act recursively including everything in the folder
-s
    This tells the script to use SSL. We certainly want to do this if there is any sensitive information being transmitted and I'd recommend doing this by default anyway.
-v
    This tells the script to be verbose, meaning it should show output all messages to the terminal.
--exclude=&quot;cache$|captchas$&quot;
    This tells the script to exclude certain folders or files based on a regular expression. In this example I want to exclude any folders called cache or captchas.
/data/media
    This is path to the folder that you want to back up. Bear in mind that this backs up everything in the folder.
--delete
    This tells the script to delete any obsolete files. So it will remove files you have deleted on your local server from the mirror.
birkoff_content:media
    This is first the bucket that you want to use (this is the one we created earlier), and then the prefix you would like. I'm backing up my media so media is a good one for me (in other manuals they use birkoff_content:/media with a / before the name of the folder, for me this create a no-name dir in the bucket and then inside that folder a &quot;media&quot; directory, so if we remove the / will be good and create a media dir inside the bucket).
&gt; /var/log/s3sync
    This tells the script to log the output into a log file. This is optoinal but I like to keep an eye on things. You'll need
to make sure your user has permissions to write to the file or the script will error. This is crude logging as it will only log the last sync.
</pre>
<p>You can run the script with a dry run by using the additional &#8211;dryrun flag and this will show you everything the script will do without it actually doing it. You can also use the -d flag to debug the script. Depending on the size of your folder syncing can take some time so be patient. That&#8217;s it &#8211; you now have a remote backup of your files that is likely to cost cents rather than dollars per month. If any files or folers are subsequently removed from or added to /data/media/ when you run the script again your remote copy will be updated to mirror your folder.<br />
Automating the task</p>
<p>To take all the administration out of this task you can automate the backup using cron. First we need to put the command into file so cron can use it.</p>
<pre class="wp-code-highlight prettyprint">
mkdir /home/your-user/shell_scripts
cd /home/your-user/shell_scripts
</pre>
<p># Create and edit the file</p>
<pre class="wp-code-highlight prettyprint">
vi s3backup.sh
</pre>
<p>Copy the script you want to run as a cron job into this file, ensuring you specify the full path to your ruby script. Remember to add #!/bin/bash or whichever shell you use at the top of the script.</p>
<pre class="wp-code-highlight prettyprint">
ruby /home/your-user/s3sync/s3sync.rb -r -s -v --exclude=&quot;cache$|captchas$&quot; --delete /data/media/ birkoff_content:media &gt; /var/log/s3sync
</pre>
<p>Save this file and then set up the cron job</p>
<pre class="wp-code-highlight prettyprint">
crontab -e
</pre>
<p># Add the following line. This runs the backup every Sunday at 6am</p>
<pre class="wp-code-highlight prettyprint">
0 6 * * 0 /home/your-user/shell_scripts/s3backup.sh
</pre>
<p>The backup will now run at 6am every Sunday without any further input from you. You can check the script is running ok by checking /var/log/s3sync (if you have created it). If you want to do it more frequently just change the cron timings.</p>
<p>And wooohoooo all our data in S3 now!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://birkoff.net/blog/automating-synchronization-of-directories-in-linux-and-amazon-s3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

