<?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>/kb &#187; Server</title>
	<atom:link href="http://grx.no/kb/category/server/feed/" rel="self" type="application/rss+xml" />
	<link>http://grx.no/kb</link>
	<description>personal knowledgebase</description>
	<lastBuildDate>Mon, 06 Feb 2012 17:05:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>SSH aliases</title>
		<link>http://grx.no/kb/2010/06/18/ssh-aliases/</link>
		<comments>http://grx.no/kb/2010/06/18/ssh-aliases/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 08:02:56 +0000</pubDate>
		<dc:creator>hgrimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://grx.no/kb/?p=198</guid>
		<description><![CDATA[In ~/.ssh/config add the following: Host ALIAS HostName DOMAIN User USERNAME Port PORT_NUMBER]]></description>
			<content:encoded><![CDATA[<p>In <code>~/.ssh/config</code> add the following:</p>

<div class="wp_syntax"><div class="code"><pre class="ssh" style="font-family:monospace;">Host ALIAS
HostName DOMAIN
User USERNAME
Port PORT_NUMBER</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2010/06/18/ssh-aliases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passwordless login with MacFusion</title>
		<link>http://grx.no/kb/2009/08/06/passwordless-login-with-macfusion/</link>
		<comments>http://grx.no/kb/2009/08/06/passwordless-login-with-macfusion/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 07:28:22 +0000</pubDate>
		<dc:creator>hgrimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[macfusion]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://grx.no/kb/?p=169</guid>
		<description><![CDATA[Put a reference to the private key file in ~/.ssh/config, for example: IdentityFile ~/.ssh/id_rsa Source: FAQS.org]]></description>
			<content:encoded><![CDATA[<p>Put a reference to the private key file in <code>~/.ssh/config</code>, for example:</p>
<pre>
IdentityFile ~/.ssh/id_rsa
</pre>
<p>Source: <a href="http://www.faqs.org/docs/securing/chap15sec121.html">FAQS.org</a></p>
]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2009/08/06/passwordless-login-with-macfusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>#1064 &#8211; You have an error in your SQL syntax</title>
		<link>http://grx.no/kb/2009/03/04/1064-you-have-an-error-in-your-sql-syntax/</link>
		<comments>http://grx.no/kb/2009/03/04/1064-you-have-an-error-in-your-sql-syntax/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 09:28:12 +0000</pubDate>
		<dc:creator>hgrimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqladmin]]></category>

		<guid isPermaLink="false">http://grx.no/kb/?p=99</guid>
		<description><![CDATA[When exporting and importing from and to different MySQL databases with diferent version numbers this error message might show up: #1064 &#8211; You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ENGINE=MyISAM DEFAULT CHARSET=utf8′ I got the message when [...]]]></description>
			<content:encoded><![CDATA[<p>When exporting and importing from and to different MySQL databases with diferent version numbers this error message might show up:</p>
<blockquote><p>#1064 &#8211; You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ENGINE=MyISAM DEFAULT CHARSET=utf8′</p></blockquote>
<p>I got the message when exporting from a MySQL 5.x database and importing to a MySQL 4.x database. The solution came to me from the following <a href="http://superaff.com/archives/2005/08/31/moving-hosts-mysql-errors/#comment-279">blog post comment</a> and is very easy. Just add the <code>--compatible</code> option:</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">mysqldump <span style="color: #CC0099;">-</span>u username <span style="color: #CC0099;">-</span>ppassword –compatible<span style="color: #CC0099;">=</span>mysql40 database_name <span style="color: #CC0099;">&gt;</span> FILENAME.sql</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2009/03/04/1064-you-have-an-error-in-your-sql-syntax/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Importing a MySQL dump file</title>
		<link>http://grx.no/kb/2009/01/06/importing-a-mysql-dump-file/</link>
		<comments>http://grx.no/kb/2009/01/06/importing-a-mysql-dump-file/#comments</comments>
		<pubDate>Tue, 06 Jan 2009 17:58:32 +0000</pubDate>
		<dc:creator>hgrimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://grx.no/kb/?p=88</guid>
		<description><![CDATA[mysql -h SERVER -uUSER -p DATABASE &#60; DUMPFILE]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-h</span> SERVER <span style="color: #660033;">-uUSER</span> <span style="color: #660033;">-p</span> DATABASE <span style="color: #000000; font-weight: bold;">&lt;</span> DUMPFILE</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2009/01/06/importing-a-mysql-dump-file/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Backing up my Macbook with rsync, SSH and Cron</title>
		<link>http://grx.no/kb/2008/09/13/backing-up-my-macbook-with-rsync-ssh-and-cron/</link>
		<comments>http://grx.no/kb/2008/09/13/backing-up-my-macbook-with-rsync-ssh-and-cron/#comments</comments>
		<pubDate>Sat, 13 Sep 2008 21:29:12 +0000</pubDate>
		<dc:creator>hgrimelid</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://grx.no/kb/?p=70</guid>
		<description><![CDATA[I&#8217;ve created a simple script which syncs my documents folder with a remote computer. The files are transferred across the SSH protocol and the backup is performed daily with assistance of cron. My rsync script is very simple: #!/bin/bash rsync -avzr --delete-excluded --exclude=&#34;*.log&#34; --exclude=&#34;*.aux&#34; --exclude=&#34;.svn&#34; --exclude=&#34;.classpath&#34; --exclude=&#34;.cache&#34; --exclude=&#34;.project&#34; --exclude=&#34;*.class&#34; --exclude=&#34;*.swp&#34; --exclude=&#34;.DS_Store&#34; --exclude=&#34;.metadata&#34; -e &#34;ssh -c [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve created a simple script which syncs my documents folder with a remote computer. The files are transferred across the SSH protocol and the backup is performed daily with assistance of cron.</p>
<p>My rsync script is very simple:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
rsync <span style="color: #660033;">-avzr</span> <span style="color: #660033;">--delete-excluded</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;*.log&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;*.aux&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;.svn&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;.classpath&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;.cache&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;.project&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;*.class&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;*.swp&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;.DS_Store&quot;</span> <span style="color: #660033;">--exclude</span>=<span style="color: #ff0000;">&quot;.metadata&quot;</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;ssh -c blowfish&quot;</span> <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>USERNAME<span style="color: #000000; font-weight: bold;">/</span>Documents USER<span style="color: #000000; font-weight: bold;">@</span>REMOTE_COMPUTER:REMOTE_DIRECTORY</pre></div></div>

<p>It was quite tricky to set up the cron job until i realized that cron does know very little of the user&#8217;s system. The trick was to add <code>SSH_AUTH_SOCK=/tmp/501/SSHKeychain.socket</code> in front of the script refrence in crontab, so that it looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">55</span> <span style="color: #000000;">21</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> <span style="color: #007800;">SSH_AUTH_SOCK</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">501</span><span style="color: #000000; font-weight: bold;">/</span>SSHKeychain.socket <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>USERNAME<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>backup.sh</pre></div></div>

<p>This will cause the backup script to run at 21:55 each night. For more info on cron, check out <a href="http://www.unixgeeks.org/security/newbie/unix/cron-1.html">unixgeeks.org</a>. Add the following at the end if you&#8217;d like to suppress the mail from cron: <code> >&#038; /dev/null</code>.</p>
<p>Note that for this script to run, SSH has to be set up with <a href="http://www.petefreitag.com/item/532.cfm">keypairs authentication.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2008/09/13/backing-up-my-macbook-with-rsync-ssh-and-cron/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Restart Apache</title>
		<link>http://grx.no/kb/2008/08/12/restart-apache/</link>
		<comments>http://grx.no/kb/2008/08/12/restart-apache/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 22:02:41 +0000</pubDate>
		<dc:creator>hgrimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://grx.no/kb/?p=36</guid>
		<description><![CDATA[I always forget how to stop/start/restart Apache (on Ubuntu), so here it is: sudo /etc/init.d/apache2 stop sudo /etc/init.d/apache2 start sudo /etc/init.d/apache2 restart]]></description>
			<content:encoded><![CDATA[<p>I always forget how to stop/start/restart Apache (on Ubuntu), so here it is:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 stop</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 start</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2008/08/12/restart-apache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php5-imagick error in Ubuntu 8.04</title>
		<link>http://grx.no/kb/2008/07/17/php5-imagick-error-in-ubuntu-804/</link>
		<comments>http://grx.no/kb/2008/07/17/php5-imagick-error-in-ubuntu-804/#comments</comments>
		<pubDate>Thu, 17 Jul 2008 11:42:17 +0000</pubDate>
		<dc:creator>hgrimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://grx.no/kb/?p=22</guid>
		<description><![CDATA[I got the following error message, caused by a bug in Ubuntu.: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/imagick.so' - libWand.so.9: cannot open shared object file: No such file or directory in Unknown on line 0 finished. Here&#8217;s the solution.]]></description>
			<content:encoded><![CDATA[<p>I got the following error message, <a href="https://bugs.launchpad.net/ubuntu/+source/php-imagick/+bug/203023">caused by a bug in Ubuntu</a>.:</p>
<pre>PHP Warning:  PHP Startup: Unable to load dynamic library
'/usr/lib/php5/20060613+lfs/imagick.so' -
libWand.so.9: cannot open shared object file:
No such file or directory in Unknown on line 0 finished.</pre>
<p><a href="http://kevin.vanzonneveld.net/techblog/article/class_imagick_not_found/">Here&#8217;s the solution</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2008/07/17/php5-imagick-error-in-ubuntu-804/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a new MySQL-user with all privileges</title>
		<link>http://grx.no/kb/2008/05/17/create-a-new-mysql-user-with-all-privileges/</link>
		<comments>http://grx.no/kb/2008/05/17/create-a-new-mysql-user-with-all-privileges/#comments</comments>
		<pubDate>Sat, 17 May 2008 17:26:24 +0000</pubDate>
		<dc:creator>hgrimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://k.grx.no/?p=17</guid>
		<description><![CDATA[GRANT ALL PRIVILEGES ON thedatabase.* TO 'theusername'@'localhost' IDENTIFIED BY 'thepassword' WITH GRANT OPTION; UPDATE 20080916: Skip the last line if the user exists.]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">ALL</span> <span style="color: #990099; font-weight: bold;">PRIVILEGES</span> <span style="color: #990099; font-weight: bold;">ON</span> thedatabase.<span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">TO</span> <span style="color: #008000;">'theusername'</span>@<span style="color: #008000;">'localhost'</span>
	IDENTIFIED BY <span style="color: #008000;">'thepassword'</span> <span style="color: #990099; font-weight: bold;">WITH</span> <span style="color: #990099; font-weight: bold;">GRANT</span> <span style="color: #990099; font-weight: bold;">OPTION</span><span style="color: #000033;">;</span></pre></div></div>

<p>UPDATE 20080916: Skip the last line if the user exists.</p>
]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2008/05/17/create-a-new-mysql-user-with-all-privileges/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup a MySQL database with mysqldump</title>
		<link>http://grx.no/kb/2008/05/14/backup-a-mysql-database-with-mysqldump/</link>
		<comments>http://grx.no/kb/2008/05/14/backup-a-mysql-database-with-mysqldump/#comments</comments>
		<pubDate>Wed, 14 May 2008 16:29:50 +0000</pubDate>
		<dc:creator>hgrimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqladmin]]></category>

		<guid isPermaLink="false">http://k.grx.no/?p=13</guid>
		<description><![CDATA[It&#8217;s very easy, but I always have to look it up. mysqldump --opt -u USERNAME -p -h HOST.HOST.COM DATABASE_TABLE &#62; DUMPFILE.sql]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s very easy, but I always have to look it up.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysqldump <span style="color: #660033;">--opt</span> <span style="color: #660033;">-u</span> USERNAME <span style="color: #660033;">-p</span> <span style="color: #660033;">-h</span> HOST.HOST.COM DATABASE_TABLE <span style="color: #000000; font-weight: bold;">&gt;</span> DUMPFILE.sql</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2008/05/14/backup-a-mysql-database-with-mysqldump/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Allow cgi scripts globally</title>
		<link>http://grx.no/kb/2008/04/23/allow-cgi-scripts-globally/</link>
		<comments>http://grx.no/kb/2008/04/23/allow-cgi-scripts-globally/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 10:41:02 +0000</pubDate>
		<dc:creator>hgrimelid</dc:creator>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[cgi]]></category>
		<category><![CDATA[httpd.conf]]></category>

		<guid isPermaLink="false">http://k.grx.no/?p=9</guid>
		<description><![CDATA[I run Apache on my Macbook and want to be able to run my cgi scripts from everywhere. All directories I want to access are symlinked from the DocumentRoot (/Library/WebServer/Documents) and the only thing necessary is to add the following directive for this section in httpd.conf: Options ExecCGI]]></description>
			<content:encoded><![CDATA[<p>I run Apache on my Macbook and want to be able to run my cgi scripts from everywhere. All directories I want to access are symlinked from the DocumentRoot (<em>/Library/WebServer/Documents</em>) and the only thing necessary is to add the following directive for this section in <em>httpd.conf</em>:</p>
<pre language="apache">Options ExecCGI</pre>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://grx.no/kb/2008/04/23/allow-cgi-scripts-globally/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

