<?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>Olof Larsson</title>
	<atom:link href="http://oloflarsson.se/feed/" rel="self" type="application/rss+xml" />
	<link>http://oloflarsson.se</link>
	<description>Programming &#38; Software Engineering</description>
	<lastBuildDate>Sun, 21 Oct 2012 08:15:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Backups for your linux server</title>
		<link>http://oloflarsson.se/backups-for-your-linux-server/</link>
		<comments>http://oloflarsson.se/backups-for-your-linux-server/#comments</comments>
		<pubDate>Tue, 17 Jul 2012 11:37:39 +0000</pubDate>
		<dc:creator>olof</dc:creator>
				<category><![CDATA[Linux Server]]></category>

		<guid isPermaLink="false">http://oloflarsson.se/?p=270</guid>
		<description><![CDATA[In this guide I describe how to setup backups for your Linux server. We will backup both locally and remotely for extra security. We will backup&#8230; MySQL-databases using automysqlbackup. Normal files using rdiff-backup. Special large folders per weekday using rsync. To a remote server using rsync. Setting up the folder structure We start out with [...]]]></description>
				<content:encoded><![CDATA[<p>In this guide I describe how to setup backups for your Linux server. We will backup both locally and remotely for extra security. We will backup&#8230;</p>
<ul>
<li>MySQL-databases using automysqlbackup.</li>
<li>Normal files using rdiff-backup.</li>
<li>Special large folders per weekday using rsync.</li>
<li>To a remote server using rsync.</li>
</ul>
<h2>Setting up the folder structure</h2>
<p>We start out with creating a folder structure like this:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>backup
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> <span style="color: #000000; font-weight: bold;">/</span>backup
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>mysql
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>files</pre></td></tr></table></div>

<p>The new root-level folder &#8220;backup&#8221; is the storage location we will use for any kind of backups. The folder &#8220;local&#8221; inside it is where we will save the backup-files for that computer itself. Later on we will add sibling folders that contain backups from other computers.</p>
<p>Note that the folder &#8220;/backup&#8221; not necessarily need to be a folder on your main storage device. It could for example be a mount point or a symlink to a folder on another storage device. This makes a lot of sense if you main storage device is an SSD. <strong>Do not backup to an SSD</strong>.</p>
<h2>Backup MySQL-databases</h2>
<p>For MySQL-databases we will use the tool <a href="http://sourceforge.net/projects/automysqlbackup/">automysqlbackup</a>. This tool is in the Ubuntu repositories. The versions are Ubuntu 12.04 with automysqlbackup 2.5 right now when I write this.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get install</span> automysqlbackup</pre></td></tr></table></div>

<p>We need to make two changes in the config file <em>&#8220;/etc/default/automysqlbackup&#8221;</em>:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">DBNAMES</span>=<span style="color: #000000; font-weight: bold;">`</span>mysql <span style="color: #660033;">--defaults-file</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>debian.cnf <span style="color: #660033;">--execute</span>=<span style="color: #ff0000;">&quot;SHOW DATABASES&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-Ev</span> <span style="color: #ff0000;">'^phpmyadmin|test|information_schema|performance_schema|mysql|Database$'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> \\\r\\\n ,\ <span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
...
&nbsp;
<span style="color: #007800;">BACKUPDIR</span>=<span style="color: #ff0000;">&quot;/backup/local/mysql&quot;</span></pre></td></tr></table></div>

<p>The grep part in DBNAMES is to exclude databases. You may want to add additional databases there that you don&#8217;t want to backup. You should now run it once to make sure it works:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">automysqlbackup</pre></td></tr></table></div>

<p>Look through the contents in &#8220;/backup/local/mysql&#8221; to verify it looks the way you want it to.</p>
<p><strong>Question:</strong> When will these backups run?<br />
<strong>Answer:</strong> When installing automysqlbackup the file <em>&#8220;/etc/cron.daily/automysqlbackup&#8221;</em> was created. Check the content of <em>&#8220;/etc/crontab&#8221;</em> to see when daily cron runs. In my case it looks like this:</p>
<pre># m h dom mon dow user    command
17 *    * * *    root    cd / &amp;&amp; run-parts --report /etc/cron.hourly
25 6    * * *    root    test -x /usr/sbin/anacron || ( cd / &amp;&amp; run-parts --report /etc/cron.daily )
47 6    * * 7    root    test -x /usr/sbin/anacron || ( cd / &amp;&amp; run-parts --report /etc/cron.weekly )
52 6    1 * *    root    test -x /usr/sbin/anacron || ( cd / &amp;&amp; run-parts --report /etc/cron.monthly )</pre>
<p>So it seems daily cron-tasks run at 06:25 on my system (Ubuntu 12.04).</p>
<h2>Backup normal files</h2>
<p>For backing up normal files we are going to use a tool called <a href="http://www.nongnu.org/rdiff-backup/">rdiff-backup</a> that creates incremental backups.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get install</span> rdiff-backup</pre></td></tr></table></div>

<p><strong>Question:</strong> How often should I backup?<br />
<strong>Answer:</strong> I personally enjoy backing up once a day.</p>
<p><strong>Question:</strong> How long should I save the backups?<br />
<strong>Answer:</strong> I personally enjoy saving the backups for three months.</p>
<p><strong>Question:</strong> What files should I backup?<br />
<strong>Answer:</strong> A good start is <em>&#8220;/home&#8221;</em>, <em>&#8220;/etc&#8221;</em> and <em>&#8220;/root&#8221;</em>. You will however often need to setup some special exclude and include rules.</p>
<p>With this in mind I should create the file <em>&#8220;/etc/cron.daily/backupfiles&#8221;</em> with the following content:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
rdiff-backup \
<span style="color: #660033;">--include</span> <span style="color: #000000; font-weight: bold;">/</span>home \
<span style="color: #660033;">--include</span> <span style="color: #000000; font-weight: bold;">/</span>etc \
<span style="color: #660033;">--include</span> <span style="color: #000000; font-weight: bold;">/</span>root \
<span style="color: #660033;">--exclude</span> <span style="color: #000000; font-weight: bold;">/</span> \
<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>files
&nbsp;
rdiff-backup <span style="color: #660033;">--force</span> <span style="color: #660033;">--remove-older-than</span> 3M <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>files</pre></td></tr></table></div>

<p>Ensure that file has the right permissions:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>cron.daily<span style="color: #000000; font-weight: bold;">/</span>backupfiles</pre></td></tr></table></div>

<p>Say however that I would like to ignore all home-files for the user &#8220;derp&#8221; and only want the folders &#8220;a&#8221; and &#8220;b&#8221; from the user &#8220;herp&#8221;.</p>
<p>The file would then look like this instead:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
rdiff-backup \
<span style="color: #660033;">--include</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>herp<span style="color: #000000; font-weight: bold;">/</span>b \
<span style="color: #660033;">--include</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>herp<span style="color: #000000; font-weight: bold;">/</span>a \
<span style="color: #660033;">--exclude</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>herp \
<span style="color: #660033;">--exclude</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>derp \
<span style="color: #660033;">--include</span> <span style="color: #000000; font-weight: bold;">/</span>home \
<span style="color: #660033;">--include</span> <span style="color: #000000; font-weight: bold;">/</span>etc \
<span style="color: #660033;">--include</span> <span style="color: #000000; font-weight: bold;">/</span>root \
<span style="color: #660033;">--exclude</span> <span style="color: #000000; font-weight: bold;">/</span> \
<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>files
&nbsp;
rdiff-backup <span style="color: #660033;">--force</span> <span style="color: #660033;">--remove-older-than</span> 3M <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>files</pre></td></tr></table></div>

<p>It is important to consider that:</p>
<blockquote><p>Multiple include and exclude options take precedence in the order they are given.<br />
- <a href="http://www.nongnu.org/rdiff-backup/examples.html#exclude">http://www.nongnu.org/rdiff-backup/examples.html#exclude</a></p></blockquote>
<p>I prefer looking at the include/exclude order like this:</p>
<ul>
<li>The deeper the directory paths &#8211; the higher up in that cron-file they should be written.</li>
<li>We can visualize the end result by imagining we apply the includes/excludes from bottom up.</li>
</ul>
<h2>Backup normal files using crontab</h2>
<p>I actually prefer having more fine grained control over when backups are run. For this we will use crontab. Start out with creating a folder for your cron-scripts:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>cron</pre></td></tr></table></div>

<p>And then create the file &#8220;/root/cron/backupfiles.sh&#8221; instead of the file <em>&#8220;/etc/cron.daily/backupfiles&#8221;</em>. Next we add a crontab entry as root:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">crontab <span style="color: #660033;">-e</span></pre></td></tr></table></div>

<p>If we want it to run the same time as automysqlbackup (06:25) the crontab entry would look like this:</p>
<pre>#m      h       dom     mon     dow     command
25      6       *       *       *       /root/cron/backupfiles.sh</pre>
<h2>Backup special large folders per weekday</h2>
<p>To be more precise I run a few minecraft servers. The map files are huge and change often because they are compressed natively. If we took incremental backups (rdiff-backup) those increments would be very large due to the compression. I prefer creating this setup instead:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>server
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>server<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>server<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>server<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">3</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>server<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>server<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>server<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">6</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>server<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">7</span></pre></td></tr></table></div>

<p>Monday is &#8220;1&#8243; and Sunday is &#8220;7&#8243;. Next we create the script &#8220;/root/cron/backupserver.sh&#8221;.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
rsync <span style="color: #660033;">-avz</span> <span style="color: #660033;">--delete</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>mc<span style="color: #000000; font-weight: bold;">/</span>files<span style="color: #000000; font-weight: bold;">/</span>server<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>server<span style="color: #000000; font-weight: bold;">/</span>$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #ff0000;">'+%u'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></td></tr></table></div>

<p>Note that after the first week the old backups will start getting overwritten.<br />
Lets add it to the root crontab as well:</p>
<pre>#m      h       dom     mon     dow     command
25      6       *       *       *       /root/cron/backupfiles.sh
35      6       *       *       *       /root/cron/backupserver.sh</pre>
<h2>Backup to a remote server</h2>
<p>For extra security it makes sense to backup to a remote computer as well. Lets call the local computer &#8220;torkel&#8221; and the remote computer &#8220;berit&#8221;. Let&#8217;s also assume entries for those are added to the file &#8220;/etc/hosts&#8221; so they resolve into actual ip-addresses.</p>
<p>For this we could simply rsync the folder &#8220;torkel:/backup/local&#8221; to &#8220;berit:/backup/torkel&#8221; but in our case the folder &#8220;torkel:/backup/local/server&#8221; will be huge. We thus only synchronize &#8220;torkel:/backup/local/1&#8243; (the monday server backup).</p>
<p>Create a user for torkel@berit and create the backup folder:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> root<span style="color: #000000; font-weight: bold;">@</span>berit
adduser torkel
<span style="color: #000000; font-weight: bold;">*</span> give it a password <span style="color: #000000; font-weight: bold;">for</span> now <span style="color: #000000; font-weight: bold;">*</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>torkel
<span style="color: #c20cb9; font-weight: bold;">chown</span> torkel.torkel <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>torkel</pre></td></tr></table></div>

<p>Create a private key for root@torkel and transfer it to torkel@berit:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> root<span style="color: #000000; font-weight: bold;">@</span>berit
<span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span>
ssh-copy-id torkel<span style="color: #000000; font-weight: bold;">@</span>berit</pre></td></tr></table></div>

<p>Remove the password from torkel@berit:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> root<span style="color: #000000; font-weight: bold;">@</span>berit
<span style="color: #c20cb9; font-weight: bold;">passwd</span> <span style="color: #660033;">-d</span> torkel</pre></td></tr></table></div>

<p>Create the script &#8220;/root/cron/backupremote.sh&#8221;.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
rsync <span style="color: #660033;">-avz</span> <span style="color: #660033;">--delete</span> \
<span style="color: #660033;">--include</span> server<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1</span> \
<span style="color: #660033;">--exclude</span> server<span style="color: #000000; font-weight: bold;">/*</span> \
<span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span> torkel<span style="color: #000000; font-weight: bold;">@</span>berit:<span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>torkel</pre></td></tr></table></div>

<p>Note that the include/exclude syntaxes are different for rsync and rdiff-backup.<br />
Lets add it to the root crontab as well:</p>
<pre>#m      h       dom     mon     dow     command
25      6       *       *       *       /root/cron/backupfiles.sh
35      6       *       *       *       /root/cron/backupserver.sh
 0      7       *       *       *       /root/cron/backupremote.sh</pre>
<h2>Restoring MySQL-databases</h2>
<p>TODO</p>
<h2>Restoring normal files</h2>
<p>TODO</p>
<h2>Restoring special large folders</h2>
<p>TODO</p>
]]></content:encoded>
			<wfw:commentRss>http://oloflarsson.se/backups-for-your-linux-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding a new storage-device</title>
		<link>http://oloflarsson.se/adding-a-new-storage-device/</link>
		<comments>http://oloflarsson.se/adding-a-new-storage-device/#comments</comments>
		<pubDate>Mon, 16 Jul 2012 14:24:11 +0000</pubDate>
		<dc:creator>olof</dc:creator>
				<category><![CDATA[Linux Server]]></category>

		<guid isPermaLink="false">http://oloflarsson.se/?p=244</guid>
		<description><![CDATA[This guide covers how to add a new storage device (such as a platter or a solid state drive) to your Linux machine. All work is done from the command-line. Selecting the right storage device This guide does not cover selecting the right model or kind of storage device. Plugging the device into the computer [...]]]></description>
				<content:encoded><![CDATA[<p>This guide covers how to add a new storage device (such as a platter or a solid state drive) to your Linux machine. All work is done from the command-line.</p>
<h2>Selecting the right storage device</h2>
<p><em>This guide does not cover selecting the right model or kind of storage device.</em></p>
<h2>Plugging the device into the computer</h2>
<p><em>This guide does not cover how to plug the device into the computer.</em></p>
<h2>What&#8217;s the device name?</h2>
<p>Now that the device is plugged into the computer we should figure out what name it got. It usually follows the pattern <strong>/dev/sdX</strong> where X is a letter (a, b, c, d&#8230;).</p>
<p>Step 1 is to find the names of all devices.</p>
<ul>
<li>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sd<span style="color: #000000; font-weight: bold;">*</span></pre></td></tr></table></div>

<p>Is a somewhat crude method that is often used and often works.</li>
<li>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>partitions</pre></td></tr></table></div>

<p>/proc/partitions will list all the block devices and partitions that the system recognizes.</li>
<li>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">fdisk</span> <span style="color: #660033;">-l</span></pre></td></tr></table></div>

<p>This will list the partition tables for the devices mentioned in /proc/partitions. I personally dislike fdisk since it can&#8217;t handle GPT partition tables. We will look into that subject later.</li>
</ul>
<p>Step 2 is to figure out which of these devices is the new one.</p>
<ul>
<li>A new storage-device almost never has a partition table setup. Perhaps you already know from the output of the previous two commands.</li>
<li>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mount</span>
<span style="color: #c20cb9; font-weight: bold;">df</span></pre></td></tr></table></div>

<p>Those two commands will give you info on what devices are mounted where and if they are filled with anything yet. Your device is probably <em><strong>not</strong> </em>mounted already.</li>
<li>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>fstab</pre></td></tr></table></div>

<p>A properly setup storage-device should have an entry in /etc/fstab. Your device is probably <strong><em>not</em> </strong>in<strong> </strong>there.</li>
</ul>
<p>You should now have figured out the device name and for the rest of the guide we will call the device /dev/sdX.</p>
<h2>Partitioning and file system</h2>
<p>You may skip this section if your storage device already has partitions and you want to keep them.</p>
<p>We use the application &#8220;parted&#8221; to setup a partition table.I personally prefer the partition table type &#8220;gpt&#8221; since it can handle disks larger than 2TB:</p>
<pre>parted
select sdX
mktable gpt
quit</pre>
<p>We now have a partition table but no partitions. You can view info on the storage-device at any time using parted &#8220;print&#8221; command:</p>
<pre>parted
select sdX
print
quit</pre>
<p>Lets create one large partition only:</p>
<pre>parted
select sdX
mkpart primary 0% 100%
quit</pre>
<p>We now have a partition covering all of the device. Note how we used %-notation and parted will then align the partition for best performance. If you try entering detailed values manually you may get the message &#8220;Warning: The resulting partition is not properly aligned for best performance.&#8221;. Now lets place an ext4 file system on that partition:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">mkfs.ext4 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdX1</pre></td></tr></table></div>

<p>And that is pretty much it. The partitions and file systems are set up. This would be all the commands in a batch:</p>
<pre>parted
select sdX
print
mktable gpt
print
mkpart primary 0% 100%
print
quit
mkfs.ext4 /dev/sdX1</pre>
<h2>Creating a mount-point</h2>
<p>A mount point is simply a directory. We should create one using the mkdir command, but where should we put it? I do not know the best practice here but the folders /media and /mnt both seem to be used for temporary mount points. As our storage device is a permanent one I suggest creating a brand new top-level folder for it. For example:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>hdd</pre></td></tr></table></div>

<p>What file permissions should this new directory have? It does not matter. They will be changed as we mount something onto the directory.</p>
<h2>Temporarily mounting the device partition</h2>
<p>To temporarily mount the device partition we can run the command:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-t</span> ext4 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdX1 <span style="color: #000000; font-weight: bold;">/</span>hdd</pre></td></tr></table></div>

<p>This will however only get it mounted once. We should create an entry in /etc/fstab to make it mount automatically on reboot.</p>
<h2>Permanently mounting the device partition using fstab</h2>
<p>Step 1 is to find the partition UUID. To add the filesystem by UUID is a good idea since you will be able to switch around with SATA hardware contacts and the system will still work. Find the UUID using any of these commands:</p>
<ul>
<li>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>disk<span style="color: #000000; font-weight: bold;">/</span>by-uuid</pre></td></tr></table></div>

</li>
<li>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">blkid</pre></td></tr></table></div>

</li>
</ul>
<p>It may also be fun to know the model number of the storage device. You may get this info using:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">hdparm <span style="color: #660033;">-I</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdX</pre></td></tr></table></div>

<p>Step 2 is to add the info to /etc/fstab. Please read up more on fstab elsewhere since my info here is not complete.</p>
<p>Are you running on an SSD? In such case you should add the &#8220;discard&#8221; option to /etc/fstab. Doing that will enable automatic TRIM and works well on ext4 filesystems. You can also stop writing last access time for files and folders by adding the option &#8220;noatime&#8221;.</p>
<p>What you add could look something like either of these two:</p>
<pre>#
# A "WDC WD1002FAEX-00Y9A0" for extra storage.
# The device was on /dev/sdb1 when added on 2012-07-16 (YYYY-MM-DD)
UUID=10e27590-16c0-44cd-9a61-07e03b97c46d /hdd ext4 defaults 0 0</pre>
<pre>#
# A Crucial M4 SSD for main storage.
# / was on /dev/sda1 during installation
UUID=6fbfc91d-e514-4bfe-a785-f3c207763dbe / ext4 noatime,discard,errors=remount-ro 0 1</pre>
<p>Make sure you leave a blank line at the end of the file. If you do not you will get a warning message in the next step:</p>
<p>Step 3 is to test that the fstab entry is correct. First unmount the /hdd using:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">umount</span> <span style="color: #000000; font-weight: bold;">/</span>hdd</pre></td></tr></table></div>

<p>In case you get the warning message &#8220;umount: /hdd: device is busy.&#8221; you are probably standing in the device. Use &#8220;cd /&#8221; to get out of there and try again.</p>
<p>Now ensure everything in /etc/fstab is correct by mounting all of it:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-a</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://oloflarsson.se/adding-a-new-storage-device/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bukkit read timed out</title>
		<link>http://oloflarsson.se/bukkit-read-timed-out/</link>
		<comments>http://oloflarsson.se/bukkit-read-timed-out/#comments</comments>
		<pubDate>Thu, 26 Apr 2012 07:28:30 +0000</pubDate>
		<dc:creator>olof</dc:creator>
				<category><![CDATA[Minecraft]]></category>

		<guid isPermaLink="false">http://oloflarsson.se/?p=230</guid>
		<description><![CDATA[Are you perhaps familiar with the two phrases: read timed out connection reset Since recently I have become quiet familiar with them myself and in this post I will describe how to get rid of them. Reason 1 &#8211; Rouge plugin Reason Description Minecraft is mainly single-threaded. The main thread has a formal name when [...]]]></description>
				<content:encoded><![CDATA[<p>Are you perhaps familiar with the two phrases:</p>
<blockquote><p>read timed out<br />
connection reset</p></blockquote>
<p>Since recently I have become quiet familiar with them myself and in this post I will describe how to get rid of them.</p>
<h1>Reason 1 &#8211; Rouge plugin</h1>
<h2>Reason Description</h2>
<p>Minecraft is mainly single-threaded. The main thread has a formal name when you look in the source code. It is called &#8220;Server thread&#8221;. If a plugin isn&#8217;t coded correctly the &#8220;Server thread&#8221; may get stuck in an eternal loop. Here is such an example: <a href="https://github.com/CypherX/xAuth/blob/91a98193717c91d2d15d0981606d6b544b874c3c/src/main/java/com/cypherx/xauth/listeners/xAuthPlayerListener.java#L215">unsafe loop in xAuth</a>. What if the player is floating over the void in a skylands-world (all empty but for some floating islands)? The while-loop would never cancel and the &#8220;Server thread&#8221; would get stuck.</p>
<h2>Reason Solution</h2>
<p>You may have 50 plugins installed. How do you find the plugin causing the issue? I use <a href="http://forums.spout.org/threads/craftbukkit.938/">CraftBukkit++</a> (called CB++). It has a nice feature that comes in handy in this situation. If the &#8220;Server thread&#8221; hangs CB++ will output a thread-dump. That thread-dump is visible both in the console and in server.log. I searched for &#8220;Server thread&#8221; and found this:</p>
<pre>2012-04-26 08:05:47 [SEVERE] ------------------------------
2012-04-26 08:05:47 [SEVERE] Current Thread: Server thread
2012-04-26 08:05:47 [SEVERE]     PID: 13 | Alive: true | State: RUNNABLE
2012-04-26 08:05:47 [SEVERE]     Stack:
2012-04-26 08:05:47 [SEVERE]         org.bukkit.craftbukkit.block.CraftBlock.isEmpty(CraftBlock.java:327)
2012-04-26 08:05:47 [SEVERE]         com.cypherx.xauth.listeners.xAuthPlayerListener.onPlayerMove(xAuthPlayerListener.java:215)
2012-04-26 08:05:47 [SEVERE]         sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)
2012-04-26 08:05:47 [SEVERE]         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2012-04-26 08:05:47 [SEVERE]         java.lang.reflect.Method.invoke(Method.java:601)
2012-04-26 08:05:47 [SEVERE]         org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:301)
2012-04-26 08:05:47 [SEVERE]         org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
2012-04-26 08:05:47 [SEVERE]         org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:461)
2012-04-26 08:05:47 [SEVERE]         net.minecraft.server.NetServerHandler.a(NetServerHandler.java:209)
2012-04-26 08:05:47 [SEVERE]         net.minecraft.server.Packet10Flying.handle(SourceFile:126)
2012-04-26 08:05:47 [SEVERE]         net.minecraft.server.NetworkManager.b(NetworkManager.java:229)
2012-04-26 08:05:47 [SEVERE]         net.minecraft.server.NetServerHandler.a(NetServerHandler.java:113)
2012-04-26 08:05:47 [SEVERE]         org.getspout.spout.SpoutNetServerHandler.a(SpoutNetServerHandler.java:169)
2012-04-26 08:05:47 [SEVERE]         net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:92)
2012-04-26 08:05:47 [SEVERE]         net.minecraft.server.MinecraftServer.w(MinecraftServer.java:625)
2012-04-26 08:05:47 [SEVERE]         net.minecraft.server.MinecraftServer.run(MinecraftServer.java:506)
2012-04-26 08:05:47 [SEVERE]         net.minecraft.server.ThreadServerApplication.run(SourceFile:492)</pre>
<p>This line tell us the location of the bad code:</p>
<pre>com.cypherx.xauth.listeners.xAuthPlayerListener.onPlayerMove(xAuthPlayerListener.java:215)</pre>
<h1>Reason 2 &#8211; todo</h1>
<p>I will add more reasons as I find them.</p>
]]></content:encoded>
			<wfw:commentRss>http://oloflarsson.se/bukkit-read-timed-out/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Searching for bukkit memory leaks</title>
		<link>http://oloflarsson.se/searching-for-bukkit-memory-leaks/</link>
		<comments>http://oloflarsson.se/searching-for-bukkit-memory-leaks/#comments</comments>
		<pubDate>Sat, 08 Oct 2011 14:34:22 +0000</pubDate>
		<dc:creator>olof</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://oloflarsson.se/?p=167</guid>
		<description><![CDATA[In this post I will describe how to search for memory leaks in your bukkit minecraft SMP server. Getting a heap dump The first step is to obtain a java heap dump to inspect. This is a nice article on the subject: http://blog.emptyway.com/2007/04/02/finding-memory-leaks-in-java-apps/ That article describes some different ways to obtain a heap dump. If [...]]]></description>
				<content:encoded><![CDATA[<p>In this post I will describe how to search for memory leaks in your bukkit minecraft SMP server.</p>
<h2>Getting a heap dump</h2>
<p>The first step is to obtain a java heap dump to inspect. This is a nice article on the subject:<br />
<a href="http://blog.emptyway.com/2007/04/02/finding-memory-leaks-in-java-apps/">http://blog.emptyway.com/2007/04/02/finding-memory-leaks-in-java-apps/</a></p>
<p>That article describes some different ways to obtain a heap dump. If you are using a JDK version of java instead of an JRE, you have some neat tools at your disposal <img src='http://oloflarsson.se/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . For example <a href="http://java.sun.com/developer/technicalArticles/Programming/HPROF.html">hprof</a> and <a href="http://download.oracle.com/javase/6/docs/technotes/tools/share/jmap.html">jmap</a>.</p>
<p><em><strong>However</strong></em> none of those tools work well together with bukkit. The tool jmap hangs the minecraft server and then crashes it. The tool hprof makes the server slow down to a crawl.</p>
<p>So we are going to use another method. We will instruct java to dump the heap if the application (bukkit) runs out of memory. We do this by passing some additional arguments when starting the server:</p>
<pre>-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp</pre>
<p>Your command could now look like this:</p>
<pre>java -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/tmp -Xms3G -Xmx3G -jar craftbukkit-0.0.1-SNAPSHOT.jar</pre>
<p>Now you should run your server till it crashes. The out of memory errors on my server looks something like this:</p>
<pre>java.lang.OutOfMemoryError: <em>GC overhead limit exceeded</em></pre>
<p>And after the crash I have a file named &#8220;/tmp/java_pid1577.hprof&#8221;. This is the heap dump we want to analyze. In order to do that I transfer it to my desktop computer using FileZilla. You would might want to compress the file before you transfer it. My file was 2.5 gigabytes so I compressed it to 186 megabytes before transfering it (6% compressions ratio :O)</p>
<pre>gzip -9 java_pid1577.hprof</pre>
<h2>Analyzing the heap dump</h2>
<p>You can now download this heap dump to your own computer and analyze it. Here are some nice free tools for doing just that:</p>
<ul>
<li><a href="http://www.eclipse.org/mat/">Eclipse Memory Analyzer</a></li>
<li><a href="http://visualvm.java.net/index.html">VisualVM</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://oloflarsson.se/searching-for-bukkit-memory-leaks/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Persistent ramdisk with tmpfs and rsync</title>
		<link>http://oloflarsson.se/how-to-set-up-a-persistent-ramdisk-with-tmpfs-and-rsync/</link>
		<comments>http://oloflarsson.se/how-to-set-up-a-persistent-ramdisk-with-tmpfs-and-rsync/#comments</comments>
		<pubDate>Sat, 01 Oct 2011 13:22:04 +0000</pubDate>
		<dc:creator>olof</dc:creator>
				<category><![CDATA[Linux Server]]></category>
		<category><![CDATA[Minecraft]]></category>

		<guid isPermaLink="false">http://oloflarsson.se/?p=149</guid>
		<description><![CDATA[Minecraft reads and writes a lot from disk. In order to speed this up we can store the files in memory instead. If you google &#8220;minecraft tmpfs&#8221; you will find a lot of info on this. The main issue is that ramdisks created using tmpfs are temporary. The content is wiped on a system reboot. [...]]]></description>
				<content:encoded><![CDATA[<p>Minecraft reads and writes a lot from disk. In order to speed this up we can store the files in memory instead. If you google &#8220;minecraft tmpfs&#8221; you will find a lot of info on this.</p>
<p>The main issue is that ramdisks created using tmpfs are temporary. The content is wiped on a system reboot.</p>
<p>The script I created takes care of persisting the ramdisk. It is a general solution that can be used for any content. Minecraft servers included.</p>
<p><a href="https://oloflarsson.se/wp-content/uploads/ramdrivetick">Download RamDriveTick</a><br />
This is the content of the file:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># QUESTIONG: What's the purpose of this script?</span>
<span style="color: #666666; font-style: italic;"># ANSWER: </span>
<span style="color: #666666; font-style: italic;"># The purpose is to mount a part of the computers RAM to a folder on the harddrive.</span>
<span style="color: #666666; font-style: italic;"># This will make IO to that folder VERY fast. However the content of such a folder</span>
<span style="color: #666666; font-style: italic;"># will be erased on system restart. This script uses rsync to mirror the content of</span>
<span style="color: #666666; font-style: italic;"># another folder on the harddrive. This way the persistance issue is solved as well</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># QUESTIONG: How do I use this script?</span>
<span style="color: #666666; font-style: italic;"># ANSWER: </span>
<span style="color: #666666; font-style: italic;"># Make sure this script runs </span>
<span style="color: #666666; font-style: italic;">#  - directly after system start</span>
<span style="color: #666666; font-style: italic;">#  - directly before system shutdown</span>
<span style="color: #666666; font-style: italic;">#  - every once in a while</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># You whould not care about the hdd-folder (on the hard-drive).</span>
<span style="color: #666666; font-style: italic;"># Work with the files in the ram-folder. This script will take care of the save and</span>
<span style="color: #666666; font-style: italic;"># load to hdd. See the hdd-folder as a persistance backup you don't need to care about :)</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># QUESTION: How do I install this? </span>
<span style="color: #666666; font-style: italic;"># QUESTION: Where should I put this script?</span>
<span style="color: #666666; font-style: italic;"># QUESTION: How do I make it execute at those times you mentioned above?</span>
<span style="color: #666666; font-style: italic;"># ANSWER: (For Ubuntu)</span>
<span style="color: #666666; font-style: italic;"># Put this script here: /etc/init.d/ramdrivetick</span>
<span style="color: #666666; font-style: italic;"># Then run this: chmod +x /etc/init.d/ramdrivetick</span>
<span style="color: #666666; font-style: italic;"># Then run this: update-rc.d ramdrivetick defaults</span>
<span style="color: #666666; font-style: italic;"># The script will now run on startup, reboot and shutdown.</span>
<span style="color: #666666; font-style: italic;"># To make it run each other create a file /etc/cron.hourly/runramdrivetick with this content</span>
<span style="color: #666666; font-style: italic;"># ---------</span>
<span style="color: #666666; font-style: italic;"># #!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># . /etc/init.d/ramdrivetick</span>
<span style="color: #666666; font-style: italic;"># ---------</span>
<span style="color: #666666; font-style: italic;"># Then run this: chmod +x /etc/cron.hourly/runramdrivetick</span>
<span style="color: #666666; font-style: italic;"># If you get this message: /bin/bash^M: bad interpreter: No such file or directory</span>
<span style="color: #666666; font-style: italic;"># This means that you have incorrect line endings in the file. Make them linux line endings.</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># QUESTION: How do I uninstall this? </span>
<span style="color: #666666; font-style: italic;"># Run this: rm /etc/cron.hourly/runramdrivetick</span>
<span style="color: #666666; font-style: italic;"># Run this: update-rc.d -f ramdrivetick remove</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># QUESTION: How can I trigger a manual &quot;tick&quot;?</span>
<span style="color: #666666; font-style: italic;"># Run this: service ramdrivetick</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># ===== Configuration START =====</span>
<span style="color: #007800;">SIZE</span>=<span style="color: #ff0000;">&quot;4000m&quot;</span> <span style="color: #666666; font-style: italic;">#Size of the RAM folder. This obviously can not be more than the RAM available on your system.</span>
<span style="color: #007800;">FOLDER_RAM</span>=<span style="color: #ff0000;">&quot;/ramdrive&quot;</span> <span style="color: #666666; font-style: italic;"># Path to the folder where the ram will be mounted</span>
<span style="color: #007800;">FOLDER_HDD</span>=<span style="color: #ff0000;">&quot;/ramdrivehdd&quot;</span> <span style="color: #666666; font-style: italic;"># Path to our backup hdd folder</span>
<span style="color: #007800;">PERMMODE</span>=<span style="color: #ff0000;">&quot;0755&quot;</span> <span style="color: #666666; font-style: italic;"># The permission for the folders. Used when creating non-existing folders and when mounting.</span>
<span style="color: #007800;">MARKFILE_INITIATED</span>=<span style="color: #ff0000;">&quot;.zz_ramdrive_initiated&quot;</span> <span style="color: #666666; font-style: italic;"># This file is used to mark if the initial move of items from hdd to ramdisk yet is done</span>
<span style="color: #007800;">MARKFILE_RUNNING</span>=<span style="color: #ff0000;">&quot;.zz_ramdrive_sync_is_running&quot;</span> <span style="color: #666666; font-style: italic;"># Marking that an action is running at the moment.</span>
<span style="color: #666666; font-style: italic;"># ===== Configuration END =====</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Calculate folderpaths for the markers</span>
<span style="color: #007800;">MARKFILE_INITIATED_FOLDER</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${FOLDER_RAM}</span>/<span style="color: #007800;">${MARKFILE_INITIATED}</span>&quot;</span>
<span style="color: #007800;">MARKFILE_RUNNING_FOLDER</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${FOLDER_RAM}</span>/<span style="color: #007800;">${MARKFILE_RUNNING}</span>&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># ===== Function Declarations START =====</span>
func_sayhi<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;====== RamDriveTick START ======&quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
func_exit<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;====== RamDriveTick END ======&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
func_mark_open<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #666666; font-style: italic;"># Stop if a sync is running already</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${MARKFILE_RUNNING_FOLDER}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;A sync is already in progress. Exiting.&quot;</span>
		func_exit
	<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #666666; font-style: italic;"># Otherwise mark this sync in progress</span>
	<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #800000;">${MARKFILE_RUNNING_FOLDER}</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
func_mark_close<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #800000;">${MARKFILE_RUNNING_FOLDER}</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
func_makefolders<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #666666; font-style: italic;"># Create the folders if they don't exist :)</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${FOLDER_HDD}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Creating hdd folder <span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">${FOLDER_HDD}</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>
		<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #800000;">${FOLDER_HDD}</span>
		<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #800000;">${PERMMODE}</span> <span style="color: #800000;">${FOLDER_HDD}</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${FOLDER_RAM}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Creating ram folder <span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">${FOLDER_RAM}</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>
		<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #800000;">${FOLDER_RAM}</span>
		<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #800000;">${PERMMODE}</span> <span style="color: #800000;">${FOLDER_RAM}</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
func_mount<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #666666; font-style: italic;"># Mount the tmpfs if it isn't already mounted</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #000000; font-weight: bold;">!</span> mountpoint <span style="color: #660033;">-q</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${FOLDER_RAM}</span>&quot;</span>; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Mounting a tmpfs with size <span style="color: #007800;">${SIZE}</span> to the ram mountpoint folder <span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">${FOLDER_RAM}</span><span style="color: #000099; font-weight: bold;">\&quot;</span>.&quot;</span>
		<span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-t</span> tmpfs <span style="color: #660033;">-o</span> <span style="color: #007800;">size</span>=<span style="color: #800000;">${SIZE}</span>,<span style="color: #007800;">mode</span>=<span style="color: #800000;">${PERMMODE}</span> tmpfs <span style="color: #800000;">${FOLDER_RAM}</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
func_sync<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #666666; font-style: italic;"># Syncronize</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${MARKFILE_INITIATED_FOLDER}</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Saving from memory to disk.&quot;</span>
		rsync <span style="color: #660033;">-av</span> <span style="color: #660033;">--delete</span> <span style="color: #660033;">--exclude</span> <span style="color: #800000;">${MARKFILE_INITIATED}</span> <span style="color: #660033;">--exclude</span> <span style="color: #800000;">${MARKFILE_RUNNING}</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${FOLDER_RAM}</span>/&quot;</span> <span style="color: #800000;">${FOLDER_HDD}</span>
	<span style="color: #000000; font-weight: bold;">else</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;INIT! The ram drive content will now be synchronized to look like the hdd content.&quot;</span>
		rsync <span style="color: #660033;">-av</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${FOLDER_HDD}</span>/&quot;</span> <span style="color: #800000;">${FOLDER_RAM}</span>
		<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #800000;">${MARKFILE_INITIATED_FOLDER}</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #666666; font-style: italic;"># ===== Function Declarations END =====</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># ===== Execute START =====</span>
func_sayhi
func_makefolders
func_mount
func_mark_open
func_sync
func_mark_close
func_exit
<span style="color: #666666; font-style: italic;"># ===== Execute END =====</span></pre></td></tr></table></div>

<p><em><strong>OR</strong></em> you could just move your whole server there <img src='http://oloflarsson.se/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  That way you won&#8217;t need to mess with symbolic links at all. If you are using the dynmap plugin you should configure so the rendered tiles are stored elsewhere. Because all those images can easily reach over 10 gigabytes.</p>
]]></content:encoded>
			<wfw:commentRss>http://oloflarsson.se/how-to-set-up-a-persistent-ramdisk-with-tmpfs-and-rsync/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Quick link to edit the hosts file on windows 7</title>
		<link>http://oloflarsson.se/quick-link-to-edit-the-hosts-file-on-windows-7/</link>
		<comments>http://oloflarsson.se/quick-link-to-edit-the-hosts-file-on-windows-7/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 11:22:14 +0000</pubDate>
		<dc:creator>olof</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://oloflarsson.se/?p=143</guid>
		<description><![CDATA[If you edit your hosts-file often it can be practical to have a shortcut that opens the file in a texteditor. This is how you would create such a shortcut on windows 7: Create a normal shortcut to the program notetad on your desktop. Edit the target of the link by adding &#8220;%SystemRoot%\system32\drivers\etc\hosts&#8221; at the [...]]]></description>
				<content:encoded><![CDATA[<p>If you edit your hosts-file often it can be practical to have a shortcut that opens the file in a texteditor. This is how you would create such a shortcut on windows 7:</p>
<ol>
<li>Create a normal shortcut to the program notetad on your desktop.</li>
<li>Edit the target of the link by adding &#8220;%SystemRoot%\system32\drivers\etc\hosts&#8221; at the end. That way the target of the link will be something like: &#8220;%windir%\system32\notepad.exe %SystemRoot%\system32\drivers\etc\hosts&#8221;.</li>
<li>When you use the link you must right-click it and select &#8220;run as administrator&#8221;. Otherwise you won&#8217;t be able so save your changes.</li>
</ol>
<p>Here is an image of the settings-window after I changed the target of the link:<br />
<a href="http://oloflarsson.se/wp-content/uploads/2011/06/hosts-via-notepad.png"><img class="alignnone size-full wp-image-144" title="Hosts file via notepad" src="http://oloflarsson.se/wp-content/uploads/2011/06/hosts-via-notepad.png" alt="" width="595" height="582" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://oloflarsson.se/quick-link-to-edit-the-hosts-file-on-windows-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating 301 redirects between many pairs of URLs</title>
		<link>http://oloflarsson.se/creating-301-redirects-between-many-pairs-of-urls/</link>
		<comments>http://oloflarsson.se/creating-301-redirects-between-many-pairs-of-urls/#comments</comments>
		<pubDate>Tue, 21 Jun 2011 11:15:56 +0000</pubDate>
		<dc:creator>olof</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://oloflarsson.se/?p=26</guid>
		<description><![CDATA[I recently upgraded a website. The website consisted of static html documents and some simple php scripts. I transformed it into a wordpress blog. In this process every url was changed. In order to keep the pagerank and not break any inlinks I created 301 redirects between them. If there had been an obvious pattern [...]]]></description>
				<content:encoded><![CDATA[<p>I recently upgraded a website. The website consisted of static html documents and some simple php scripts. I transformed it into a wordpress blog. In this process every url was changed. In order to keep the pagerank and not break any inlinks I created 301 redirects between them.</p>
<p><strong>If there had been an obvious pattern</strong> between the old and new urls this would have been a simple task.<br />
For example lets say urls of the pattern:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="txt" style="font-family:monospace;">http://www.website1.com/[pagename].html</pre></td></tr></table></div>

<p>should be changed into:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="txt" style="font-family:monospace;">http://www.website2.com/[pagename]/</pre></td></tr></table></div>

<p>Then I could just have used this in my .htaccess file on website1:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="txt" style="font-family:monospace;">RedirectMatch 301 ^/(.*)\.html$ http://www.website2.com/$1/</pre></td></tr></table></div>

<p><strong>But in this case</strong> there where no obvious patterns. Some of the old pages where converted to wordpress pages, some to wordpress posts and some to a wordpress category with the old text as the description for the category. All this resulting in a wide variety of new urls.</p>
<p>I solved the situation like this:<br />
First i used a sitemap generator to get a list of all the urls that I needed to rewrite. If you google for &#8220;sitemap generator&#8221; you will find one. Myself I used <a href="http://www.xml-sitemaps.com/">http://www.xml-sitemaps.com/</a>. After your sitemap is generated choose the alternative &#8220;Download Sitemap in Text Format&#8221; and you will get a txt file with the urls. It might look like this:</p>
<p><em><strong>urls.txt</strong></em></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="txt" style="font-family:monospace;">http://www.website1.com/information-about-foo.html
http://www.website1.com/a-page-about-bar.htm
http://www.website1.com/index.php?pageid=foo
http://www.website1.com/index.php?pageid=foo&amp;amp;a=b
http://www.website1.com/index.php?pageid=bar
...</pre></td></tr></table></div>

<p>Now after each url add the corresponding new url you want to redirect to (sepparate with space). It might look like this:</p>
<p><em><strong>urls.txt</strong></em></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="txt" style="font-family:monospace;">http://www.website1.com/information-about-foo.html http://www.website2.com/information-about-foo/
http://www.website1.com/a-page-about-bar.htm http://www.website2.com/a-page-about-bar/
http://www.website1.com/index.php?pageid=foo http://www.website2.com/foo/
http://www.website1.com/index.php?pageid=foo&amp;amp;a=b http://www.website2.com/foo/?a=b
http://www.website1.com/index.php?pageid=bar http://www.website2.com/bar/
...</pre></td></tr></table></div>

<p>Next I created this python3 script to generate the content for my .htaccess file:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="python" style="font-family:monospace;">fh <span style="color: #66cc66;">=</span> <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'urls.txt'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span>
lines <span style="color: #66cc66;">=</span> fh.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'RewriteEngine on'</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> line <span style="color: #ff7700;font-weight:bold;">in</span> lines :
	parts <span style="color: #66cc66;">=</span> line.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot; &quot;</span><span style="color: black;">&#41;</span>
	from_url <span style="color: #66cc66;">=</span> parts<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
	to_url <span style="color: #66cc66;">=</span> parts<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">if</span> to_url.<span style="color: black;">count</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'?'</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">==</span> <span style="color: #ff4500;">0</span> :
		to_url +<span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'?'</span>
	<span style="color: #ff7700;font-weight:bold;">if</span> from_url.<span style="color: black;">count</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'?'</span><span style="color: black;">&#41;</span>:
		<span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;RewriteCond %{QUERY_STRING} ^&quot;</span> + from_url.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'?'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> +<span style="color: #483d8b;">&quot;$&quot;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;RewriteRule ^&quot;</span> + from_url.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'?'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\.</span>'</span><span style="color: black;">&#41;</span> + <span style="color: #483d8b;">&quot;$ &quot;</span> + to_url + <span style="color: #483d8b;">&quot; [R=301,L]&quot;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">else</span>:
		<span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;RewriteRule ^&quot;</span> + from_url.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'.'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\.</span>'</span><span style="color: black;">&#41;</span> + <span style="color: #483d8b;">&quot;$ &quot;</span> + to_url + <span style="color: #483d8b;">&quot; [R=301,L]&quot;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://oloflarsson.se/creating-301-redirects-between-many-pairs-of-urls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reading browser saved passwords</title>
		<link>http://oloflarsson.se/reading-browser-saved-passwords/</link>
		<comments>http://oloflarsson.se/reading-browser-saved-passwords/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 14:58:54 +0000</pubDate>
		<dc:creator>olof</dc:creator>
				<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://oloflarsson.se/?p=120</guid>
		<description><![CDATA[Assume you forgot you gmail password but you allowed the browser to remember it for you. You can still log in as the browser fills out the password for you, but you can not find out what the password is as all you see is some stars or dots. The situation is cool for now, [...]]]></description>
				<content:encoded><![CDATA[<p>Assume you forgot you gmail password but you allowed the browser to remember it for you. You can still log in as the browser fills out the password for you, but you can not find out what the password is as all you see is some stars or dots. The situation is cool for now, as you can log in, but as soon as you clear your browser cache the brower will forget the password and then you are screwed :/</p>
<h2>The solution</h2>
<p><strong>Paste this into you your browserbar</strong> (where you type in the URL) and press enter:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="" style="font-family:monospace;">javascript: var element = document.createElement<span class="br0">&#40;</span>'script'<span class="br0">&#41;</span>; element.setAttribute<span class="br0">&#40;</span>&quot;src&quot;, &quot;http://oloflarsson.se/wp-content/uploads/reveal.js&quot;<span class="br0">&#41;</span>; document.getElementsByTagName<span class="br0">&#40;</span>&quot;head&quot;<span class="br0">&#41;</span><span class="br0">&#91;</span><span style="">0</span><span class="br0">&#93;</span>.appendChild<span class="br0">&#40;</span>element<span class="br0">&#41;</span>; void<span class="br0">&#40;</span><span style="">0</span><span class="br0">&#41;</span>;</pre></td></tr></table></div>

<p><strong>It should look something like this:</strong></p>
<p><a href="http://oloflarsson.se/wp-content/uploads/2011/04/revealer_howto.png"><img class="alignnone size-full wp-image-127" title="revealer_howto" src="http://oloflarsson.se/wp-content/uploads/2011/04/revealer_howto.png" alt="" width="479" height="233" /></a></p>
<p>When pressing enter the situation will transform <strong>from this</strong>:</p>
<p><a href="http://oloflarsson.se/wp-content/uploads/2011/04/revealer_before.png"><img class="alignnone size-full wp-image-121" title="revealer_before" src="http://oloflarsson.se/wp-content/uploads/2011/04/revealer_before.png" alt="" width="479" height="233" /></a></p>
<p><strong>To this</strong>:</p>
<p><a href="http://oloflarsson.se/wp-content/uploads/2011/04/revealer_after.png"><img class="alignnone size-full wp-image-122" title="revealer_after" src="http://oloflarsson.se/wp-content/uploads/2011/04/revealer_after.png" alt="" width="479" height="233" /></a></p>
<p>Where &#8220;mypassword&#8221; is the password that was hidden behind the dots.<br />
Note that this method <strong>will work on any password field</strong> on any web page.<br />
You are <strong>not restricted to gmail</strong> <img src='http://oloflarsson.se/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now be nice, don&#8217;t use this to steal your friends password logins `:-P</p>
<h2>Help! There are no dots in my password field :/</h2>
<p>Do not give up just yet. Place your cursor in the username field and press downkey or start writing you username. This will trigger the autocomplete feature and might finally fill out the password for you:</p>
<p><a href="http://oloflarsson.se/wp-content/uploads/2011/04/revealer_triggertheautocomplete.png"><img class="alignnone size-full wp-image-130" title="revealer_triggertheautocomplete" src="http://oloflarsson.se/wp-content/uploads/2011/04/revealer_triggertheautocomplete.png" alt="" width="479" height="233" /></a></p>
<h2>How does it work?</h2>
<p>The javascript above includes and executes this .js file: <a href="http://oloflarsson.se/wp-content/uploads/reveal.js">http://oloflarsson.se/wp-content/uploads/reveal.js</a></p>
<p>Which is basically the same as first including the js library jQuery. You can do it this way:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;">javascript<span style="color: #339933;">:</span>
<span style="color: #000066; font-weight: bold;">var</span> element <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'script'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
element.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;src&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;http://code.jquery.com/jquery.min.js&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;head&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>element<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
alert<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;JQuery was loaded.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">void</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>And then running this:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;">javascript<span style="color: #339933;">:</span>
$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'input[type=&quot;password&quot;]'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">after</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;input type=&quot;text&quot; value=&quot;'</span><span style="color: #339933;">+</span>$<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'value'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'&quot; /&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">void</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://oloflarsson.se/reading-browser-saved-passwords/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a Minecraft SMP Bukkit Server</title>
		<link>http://oloflarsson.se/creating-a-minecraft-smp-bukkit-server/</link>
		<comments>http://oloflarsson.se/creating-a-minecraft-smp-bukkit-server/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 22:42:55 +0000</pubDate>
		<dc:creator>olof</dc:creator>
				<category><![CDATA[Linux Server]]></category>
		<category><![CDATA[Minecraft]]></category>
		<category><![CDATA[minecraft server setup]]></category>

		<guid isPermaLink="false">http://oloflarsson.se/?p=72</guid>
		<description><![CDATA[Get a VPS In the long run you should use a VPS instead of hosting on your own computer. This way you can turn of your computer at home and still be able host the server 24/7. The server should have at least one gigabyte ram. The server should not use OpenVZ for virtualization. It [...]]]></description>
				<content:encoded><![CDATA[<h3>Get a VPS</h3>
<p>In the long run you should use a VPS instead of hosting on your own computer. This way you can turn of your computer at home and still be able host the server 24/7.</p>
<ul>
<li>The server should have at least one gigabyte ram.</li>
<li>The server should <em><strong>not </strong></em><strong>use OpenVZ</strong> for virtualization. It would work but you might face memory allocation issues. You should <strong>go for Xen</strong> virtualization.</li>
</ul>
<p>In the continuation I will assume the VPS is using Ubuntu as OS.</p>
<h3>Install Java</h3>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get update</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> openjdk-<span style="color: #000000;">7</span>-jdk</pre></td></tr></table></div>

<p>That will install java for you.</p>
<h3>Get the minecraft server</h3>
<p>http://wiki.bukkit.org/Setting_up_a_server</p>
<h3>Start it</h3>
<p>You should get to know the terminal command <em><strong>screen </strong></em>if you does not already.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get update</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> <span style="color: #c20cb9; font-weight: bold;">screen</span></pre></td></tr></table></div>

<p>Now you can start the server in a screen and detach from it to keep the server running.</p>
]]></content:encoded>
			<wfw:commentRss>http://oloflarsson.se/creating-a-minecraft-smp-bukkit-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My server setup checklist</title>
		<link>http://oloflarsson.se/my-server-setup-checklist/</link>
		<comments>http://oloflarsson.se/my-server-setup-checklist/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 22:09:03 +0000</pubDate>
		<dc:creator>olof</dc:creator>
				<category><![CDATA[Linux Server]]></category>

		<guid isPermaLink="false">http://oloflarsson.se/?p=67</guid>
		<description><![CDATA[This is the checklist I follow when I create a new Linux Debian Server. The goal is a safe shared hosting environment where every user can ssh to the server but no user can see the content of another users home folder. Setup language You need to setup language if you get error messages like [...]]]></description>
				<content:encoded><![CDATA[<p>This is the checklist I follow when I create a new Linux Debian Server.<br />
The goal is a safe shared hosting environment where every user can ssh to the server but no user can see the content of another users home folder.</p>
<h2>Setup language</h2>
<p>You need to setup language if you get error messages like this one</p>
<div>
<div>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = <span style="color: #ff0000;">&quot;en_US.UTF-8&quot;</span>,
        LC_ALL = <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">unset</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>,
        LANG = <span style="color: #ff0000;">&quot;en_US.UTF-8&quot;</span>
    are supported and installed on your system.
perl: warning: Falling back to the standard locale <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;C&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>.</pre></td></tr></table></div>

</div>
</div>
<p>Run the following two commands to solve the issue:</p>
<div>
<div>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">locale-gen en_US en_US.UTF-<span style="color: #000000;">8</span>
dpkg-reconfigure locales</pre></td></tr></table></div>

</div>
</div>
<h2>File Permissions</h2>
<p>Files should be restricted to the owner only. This must be the case for newly created files. Thus we set an umask that works both locally and over SSH. We also ensure the home folder for the current user, as well as future ones, has those strict permissions.</p>
<ol>
<li>In the file <strong>/etc/login.defs</strong><br />
do: <strong>umask 077</strong></li>
<li>In the file <strong>/etc/profile</strong><br />
do: <strong>umask 077</strong></li>
<li>In the file <strong>/etc/pam.d/common-session</strong><br />
do: <strong>session optional pam_umask.so umask=077<br />
</strong>(you might just need to append &#8221; umask=077&#8243; at the end of an existing line)<strong><br />
</strong></li>
<li>In the file <strong>/etc/adduser.conf</strong><br />
do: <strong>DIR_MODE=0700</strong></li>
<li>run: <strong>chmod -r 700 /home/CURRENTUSER</strong></li>
</ol>
<h2>Login security and Root login security and sudoers</h2>
<p>You should not be able to log in as root using password. Instead we use key authentication for root.</p>
<ul>
<li>Paste your public key into /root/.ssh/authorized_keys</li>
<li>Try to log in using your key to make sure this works.</li>
<li>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">passwd</span> <span style="color: #660033;">-d</span> root</pre></td></tr></table></div>

</li>
<li>Modify /etc/sudoers to give your own account full sudo rights. My file looks like this somewhere in the middle:
<pre># User privilege specification
root	ALL=(ALL) ALL
UNAME	ALL=(ALL) ALL</pre>
<p>That is a kinda crude way to do it. <a href="http://askubuntu.com/questions/7477/how-can-i-add-a-new-user-as-sudoer">On ubuntu the standard way to do is to add the user to the admin group</a>:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> adduser USERNAME admin</pre></td></tr></table></div>

</li>
</ul>
<h2>IP configuration</h2>
<p>http://www.go2linux.org/add-second-ip-linux-ubuntu-etc-network-interfaces-709.html</p>
<p>http://www.cyberciti.biz/tips/howto-ubuntu-linux-convert-dhcp-network-configuration-to-static-ip-configuration.html</p>
<p>http://www.cyberciti.biz/faq/setting-up-an-network-interfaces-file/</p>
<ol>
<li>Make the changes to /etc/network/interfaces</li>
<li>/etc/init.d/networking restart</li>
</ol>
<h2>Configure mounts and limit disk IO</h2>
<p>Please start with reading my <a href="/adding-a-new-storage-device"><strong>guide on how to add storage devices</strong></a>.</p>
<p>If you have loads of RAM available and want to limit disc IO you can tell the kernel to avoid swapping processes out of physical memory for as long as possible:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> sysctl vm.swappiness=<span style="color: #000000;">0</span></pre></td></tr></table></div>

<h2>Add/Remove new users</h2>
<p><strong>To add</strong> a new user use the command: <strong>adduser [username]</strong><br />
Note that usage of this command (adduser) is recommended compared to using the more lowlevel command useradd.</p>
<p><strong>To remove</strong> a user use the command: <strong>userdel -fr [username]</strong><br />
The -fr part makes sure home folder and other files are delete.<br />
Without it you will have to delete the files using another command.</p>
<p><strong>To list</strong> the current users: <strong>cat /etc/passwd | cut -d&#8221;:&#8221; -f1</strong></p>
<h2>Install webserver packages</h2>
<p lang="bash">We instal:</p>
<ul>
<li>Apache using the ITK mpm due to security reasons and mod macro</li>
<li>PHP and some must have extenstions</li>
<li>PHPMyAdmin</li>
<li>Postfix</li>
</ul>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> apache2 apache2-mpm-itk
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> libapache2-mod-macro
<span style="color: #c20cb9; font-weight: bold;">sudo</span> a2enmod macro proxy_http rewrite
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> php5 php5-gd php5-curl php5-mcrypt
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> mysql-server mysql-client libapache2-mod-auth-mysql php5-mysql
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> phpmyadmin
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> postfix</pre></td></tr></table></div>

<h2>Configure PHP</h2>
<p>Change the following values in /etc/php5/apache2/php.ini<br />
To increase some limits</p>
<ul>
<li>upload_max_filesize = 50M</li>
<li>post_max_size = 50M</li>
</ul>
<h2>Configure MySQL</h2>
<p>We want mysql to use utf8 per default instead of latin1. Find your MySQL configuration file (on most Linux/BSD systems it’s /etc/mysql/my.cnf) and make sure it’s got the following statements under the relevant headers. None of these settings should be set per default so just paste them directly under the corresponding header:</p>
<pre>[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci</pre>
<p>Also make sure you only accept connections from localhost. This is good for security and is the default in Ubuntu 11.10:</p>
<pre>[mysqld]
bind-address=127.0.0.1</pre>
<p>If you scan your computer from the outside using nmap you will notice that port 3306 is actually closed from the outside world. With this setting there is no reason to add firewall rules for it.</p>
<p>Restart MySQL and make sure it’s working;</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">service mysql restart</pre></td></tr></table></div>

<p>TODO: query cache size etc.</p>
<h2>Configure Apache2</h2>
<p>Do you get this message?</p>
<pre>apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName</pre>
<p>We just need to tell apache what the name of the server is. The name of my server is &#8220;berit&#8221;. So I &#8220;ServerName berit&#8221; to /etc/apache2/httpd.conf:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>ServerName berit&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">tee</span> <span style="color: #660033;">--append</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>httpd.conf</pre></td></tr></table></div>

<ul>
<li>Upload <a href="https://gist.github.com/890304">the file default.conf</a> as /etc/apache2/ssl/default.conf</li>
<li>Upload <a href="https://gist.github.com/890304">the file macro</a> as /etc/apache2/conf.d/macro</li>
<li>Upload <a href="https://gist.github.com/890304">the file macrobased</a> as /etc/apache2/sites-available/macrobased</li>
<li>Changes in <a href="https://gist.github.com/890304">/etc/apache2/conf.d/security</a></li>
<li>Add this to /etc/apache2/ports.conf:
<pre>NameVirtualHost *:443</pre>
</li>
<li>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> a2enmod rewrite
<span style="color: #c20cb9; font-weight: bold;">sudo</span> a2enmod ssl
<span style="color: #c20cb9; font-weight: bold;">sudo</span> a2dissite <span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">*</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>sites-available<span style="color: #000000; font-weight: bold;">/</span>default
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>sites-available<span style="color: #000000; font-weight: bold;">/</span>default-ssl
<span style="color: #c20cb9; font-weight: bold;">sudo</span> a2ensite macrobased
<span style="color: #c20cb9; font-weight: bold;">sudo</span> service apache2 reload</pre></td></tr></table></div>

</li>
<li>Per default we do not log access. Uncomment the line in<br />
/etc/apache2/conf.d/other-vhosts-access-log so it reads:</p>
<pre># Define an access log for VirtualHosts that don't define their own logfile
# CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined</pre>
</li>
</ul>
<h2>Configure PHPMyAdmin</h2>
<p>Open the file /etc/phpmyadmin/config.inc.php</p>
<p>You may want to hide some system databases from the web interface. To do that you would add a row like this to the middle of the file:</p>
<ul>
<li>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cfg</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Servers'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hide_db'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'information_schema'</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</li>
<li>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cfg</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Servers'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hide_db'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'^information_schema|mysql|performance_schema|phpmyadmin|test$'</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

</li>
</ul>
<p>Add these rows to the end of the file to force SSL and increase the max rows per page:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cfg</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ForceSSL'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$cfg</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'MaxRows'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1000</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>If you wan&#8217;t to be able to autologin as root (<span style="color: #ff0000;"><strong>dangerous</strong></span> but handy on local installations):</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$cfg</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Servers'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'AllowNoPassword'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'true'</span><span style="color: #339933;">;</span> 
<span style="color: #000088;">$cfg</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Servers'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'auth_type'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'config'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$cfg</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Servers'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'user'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'root'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$cfg</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Servers'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h2>Setting up Backups</h2>
<p>I have written a separate guide on <a href="/backups-for-your-linux-server"><strong>how to setup backups for your linux server</strong></a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://oloflarsson.se/my-server-setup-checklist/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
