<?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>Andrew Mallis&#039; blog &#187; Linux</title>
	<atom:link href="http://andrewmallis.com/blog/category/technology/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://andrewmallis.com/blog</link>
	<description>this is the personal blog for Andrew Mallis</description>
	<lastBuildDate>Sat, 19 Nov 2011 09:39:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Sequel Pro: look at the nerdy things I can do at 1 AM</title>
		<link>http://andrewmallis.com/blog/2010/06/03/sequel-pro-look-at-the-nerdy-things-i-can-do-at-1-am</link>
		<comments>http://andrewmallis.com/blog/2010/06/03/sequel-pro-look-at-the-nerdy-things-i-can-do-at-1-am#comments</comments>
		<pubDate>Thu, 03 Jun 2010 09:12:48 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[tech tips]]></category>

		<guid isPermaLink="false">http://andrewmallis.com/blog/?p=299</guid>
		<description><![CDATA[Did I tell you about Sequel Pro? You can use it to connect to your local MAMP and also to remote LAMP mysql servers (via SSH). Why is this so awesome? Well, not only is it 100 times faster than that phpMyAdmin, but you can edit your DB super easily, like a spreadsheet. It is [...]]]></description>
			<content:encoded><![CDATA[<p>Did I tell you about <a href="http://www.sequelpro.com" title="check out the sequel pro site" target="_blank" class="liexternal">Sequel Pro</a>?</p>
<p>You can use it to connect to your local MAMP and also to <strong>remote</strong> LAMP mysql servers (via SSH). Why is this so awesome?</p>
<p style="text-align: left;">Well, not only is it 100 times faster than that phpMyAdmin, but you can edit your DB super easily, like a spreadsheet. It is a snap to filter/search/order a table for viewing and editing.<em> </em></p>
<p style="text-align: left;"><em>Caveat emptor</em>: what I am about to show you <span style="text-decoration: underline;">can do tremendous damage</span>. You can accidentally kill your entire application, so BACK YOUR DATABASES UP! Test on a copy first.<span id="more-299"></span></p>
<p style="text-align: left;">You can do simple things like turn 1&#8242;s to 0&#8242;s and quickly disable a drupal module faster than drush can (but watch out if you don&#8217;t know your dependencies).</p>
<div id="attachment_300" class="wp-caption aligncenter" style="width: 510px"><a href="http://andrewmallis.com/blog/wp-content/uploads/2010/06/sequelpro-edit-system.png" class="liimagelink"><img class="size-full wp-image-300  " title="sequelpro-edit-system" src="http://andrewmallis.com/blog/wp-content/uploads/2010/06/sequelpro-edit-system.png" alt="Edit your system table in Sequel Pro" width="500" height="319" /></a><p class="wp-caption-text">Edit your system table in Sequel Pro</p></div>
<p>I had this interesting and daunting problem:<br />
I am working on this site for a soccer league that has a couple hundred teams and I realize that I need to modify a whole slew of node titles based on values that appear in their CCK fields.<br />
Many of the Organic Group Group nodes (each team is a group)<br />
Views Bulk Operations gets me part, but not all the way quickly enough for this one-time operation.</p>
<p>I&#8217;m not crafty enough to write a join and update statement across all these tables, but I do already have a view listing Teams and CCK fields for Division and Type.</p>
<p>Hey, if I scroll down to the bottom of the view, I can copy the query right from views into Sequel Pro!</p>
<p>Holy Moly. It just works. As it should.</p>
<div id="attachment_301" class="wp-caption aligncenter" style="width: 509px"><a href="http://andrewmallis.com/blog/wp-content/uploads/2010/06/sequelpro-viiews-edit-nodes.png" class="liimagelink"><img class="size-full wp-image-301  " title="Edit join statments from views" src="http://andrewmallis.com/blog/wp-content/uploads/2010/06/sequelpro-viiews-edit-nodes.png" alt="Edit the result of a sequel statement created with views" width="499" height="329" /></a><p class="wp-caption-text">Edit the result of a sequel statement created with views</p></div>
<p>Now I can just go down the list and edit my node titles.<br />
Sweet.</p>
<p>Because there was a pattern here, I ended up using  the fabulous <a href="http://drupal.org/project/auto_nodetitle" title="project on drupal.org" target="_blank" class="liexternal">auto nodetitle</a> module and tokens. I temporarliy added a pattern to the node titles of my team content type and used <a href="http://drupal.org/project/views_bulk_operations" title="project on drupal.org" target="_blank" class="liexternal">views bulk operations</a> to update <em>some</em> of my node titles. After the update, i set the pattern to be used only if the title was blank.</p>
<p>Even though I solved my use case another way, I can see plenty of use for this technique in the future. Great way to fix typos in content, for example.</p>
<div id="bppostbookmarks"><a href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2010%2F06%2F03%2Fsequel-pro-look-at-the-nerdy-things-i-can-do-at-1-am&t=Sequel+Pro%3A+look+at+the+nerdy+things+I+can+do+at+1+AM" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/yahoo-icon.png" alt="Add to Yahoo" title="Add to Yahoo" /></a> <a href="http://www.google.com/bookmarks/mark?op=add&bkmk=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2010%2F06%2F03%2Fsequel-pro-look-at-the-nerdy-things-i-can-do-at-1-am&title=Sequel+Pro%3A+look+at+the+nerdy+things+I+can+do+at+1+AM" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/g-icon.png" alt="Add to Google" title="Add to Google" /></a> <a href="http://del.icio.us/post?&url=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2010%2F06%2F03%2Fsequel-pro-look-at-the-nerdy-things-i-can-do-at-1-am&title=Sequel+Pro%3A+look+at+the+nerdy+things+I+can+do+at+1+AM" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/delicious-icon.png" alt="Save to Del.icio.us" title="Save to Del.icio.us" /></a> <a href="http://digg.com/submit?phase=2&url=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2010%2F06%2F03%2Fsequel-pro-look-at-the-nerdy-things-i-can-do-at-1-am&title=Sequel+Pro%3A+look+at+the+nerdy+things+I+can+do+at+1+AM&bodytext=&topic=" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/digg-icon.png" alt="Digg IT!" title="Digg IT!" /></a> <a href="https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2010%2F06%2F03%2Fsequel-pro-look-at-the-nerdy-things-i-can-do-at-1-am&title=Sequel+Pro%3A+look+at+the+nerdy+things+I+can+do+at+1+AM&top=1" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/live-icon.gif" alt="Live Bookmarks!" title="Live Bookmarks!" /></a> </div>]]></content:encoded>
			<wfw:commentRss>http://andrewmallis.com/blog/2010/06/03/sequel-pro-look-at-the-nerdy-things-i-can-do-at-1-am/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>how to back up databases using phpMyAdmin</title>
		<link>http://andrewmallis.com/blog/2009/06/02/how-to-back-up-databases-using-phpmyadmin</link>
		<comments>http://andrewmallis.com/blog/2009/06/02/how-to-back-up-databases-using-phpmyadmin#comments</comments>
		<pubDate>Wed, 03 Jun 2009 01:04:30 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[tech tips]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[phpMyAdmin]]></category>

		<guid isPermaLink="false">http://andrewmallis.com/blog/?p=234</guid>
		<description><![CDATA[Back ups are important. Like brushing your teeth, it&#8217;s something you should do routinely. And, as you&#8217;d brush before important events, like going out on a date, so should you too backup before upgrading software. I&#8217;m going to show you how to use phpMyAdmin to back up and restore MySQL databases. In my next post, [...]]]></description>
			<content:encoded><![CDATA[<p><span id="sample-permalink">Back ups are important. Like brushing your teeth, it&#8217;s something you should do routinely. And, as</span><span id="sample-permalink"> you&#8217;d brush before important events, like going out on a date, so should you too backup before upgrading </span>software.</p>
<p>I&#8217;m going to show you how to use <a href="http://www.phpmyadmin.net" target="_blank" class="liexternal">phpMyAdmin</a> to back up and restore MySQL databases. In my next post, I&#8217;ll show you how to graduate to doing the same thing using the command line.</p>
<p>I use <a href="http://www.mamp.info/" target="_blank" class="liexternal">MAMP</a> to develop websites locally. I&#8217;ve written about this before <a href="http://andrewmallis.com/blog/2007/11/03/mamp-and-xamp" class="liinternal">here</a>. The examples I&#8217;ll be showing come from the phpMyAdmin packaged with MAMP, but apply just as well to any other environment.<span id="more-234"></span></p>
<h2>phpMyAdmin without the MAMP frame</h2>
<p style="text-align: left;">First things first. Let&#8217;s  work so we can see what we&#8217;re doing.I&#8217;m going to assume that you&#8217;re able to download and install MAMP or MAMP Pro on your own. The phpMyAdmin URL that you from the MAMP default webstart page gets you to the URL:</p>
<p style="text-align: left;"><a href="http://localhost/MAMP/frame.php?src=%2FphpMyAdmin%2F%3Flang%3Den-iso-8859-1&amp;language=English" target="_blank" class="liexternal">http://localhost/MAMP/frame.php?src=%2FphpMyAdmin%2F%3Flang%3Den-iso-8859-1&amp;language=English</a></p>
<p>which looks gives you a framed version of the phpMyAdmin. The framing takes up a lot of screen real estate.</p>
<p style="text-align: center;"><a href="http://andrewmallis.com/blog/wp-content/uploads/2009/06/phpmyadmin_noframe-250x201.png" class="liimagelink"><img class="size-full wp-image-239 aligncenter" title="phpmyadmin_mampframe" src="http://andrewmallis.com/blog/wp-content/uploads/2009/06/phpmyadmin_mampframe-250x201.png" alt="phpMyAdmin widow with the MAMP framing" width="250" height="201" /></a></p>
<p>Instead, use <a href="http://localhost/phpMyAdmin" target="_blank" class="liexternal">http://localhost/phpMyAdmin</a> and you&#8217;ll get something that looks much more pleasing:</p>
<p style="text-align: center;"><a href="http://andrewmallis.com/blog/wp-content/uploads/2009/06/phpmyadmin_noframe-250x201.png" class="liimagelink"><img class="size-full wp-image-238 aligncenter" title="phpmyadmin_noframe" src="http://andrewmallis.com/blog/wp-content/uploads/2009/06/phpmyadmin_noframe-250x201.png" alt="phpMyAdmin window without a frame" width="250" height="201" /></a></p>
<h2>dumping a database with phpMyAdmin</h2>
<p>Select a database from the drop-down menu on the left hand side of phpMyAdmin. Or, Navigate to &#8220;home&#8221; by clicking the little house under the phpMyAdmin logo in the top left and hit the blue Databases link in the  longish list there.<a href="http://andrewmallis.com/blog/wp-content/uploads/2009/06/phpmyadmin_home.png" class="liinternal"></a></p>
<p style="text-align: center;"><a href="http://andrewmallis.com/blog/wp-content/uploads/2009/06/phpmyadmin_home.png" class="liimagelink"><img class="size-full wp-image-245 aligncenter" title="phpmyadmin_home" src="http://andrewmallis.com/blog/wp-content/uploads/2009/06/phpmyadmin_home-250x182.png" alt="phpmyadmin_home" width="250" height="182" /></a></p>
<p>Ok, so now we see the tables in our database. Press the Export tab at the top. We&#8217;re going to export this database.</p>
<p style="text-align: center;"><a href="http://andrewmallis.com/blog/wp-content/uploads/2009/06/phpmyadmin_table-250x214.png" class="liimagelink"><img class="aligncenter size-full wp-image-253" title="phpmyadmin_table" src="http://andrewmallis.com/blog/wp-content/uploads/2009/06/phpmyadmin_table-250x214.png" alt="phpmyadmin_table" width="250" height="214" /></a></p>
<p>Let&#8217;s review the options you should select to get nice, compact, and legible SQL.</p>
<p style="text-align: center;"><a href="http://andrewmallis.com/blog/wp-content/uploads/2009/06/phpmyadmin2102_exportdb3-600x632.png" class="liimagelink"><img class="aligncenter size-full wp-image-252" title="phpmyadmin2102_exportdb3" src="http://andrewmallis.com/blog/wp-content/uploads/2009/06/phpmyadmin2102_exportdb3-600x632.png" alt="phpmyadmin2102_exportdb3" width="600" height="632" /></a></p>
<p>The first column, in the Export fieldset, is pretty straight forward. By default all the tables in your database will be selected. SQL is the format you want too.</p>
<p>&#8220;Disable foreign key checks&#8221; isn&#8217;t always necessary. I do a lot of CiviCRM work. Restoring a CiviCRM database will fail unless this option is enabled in your export.</p>
<p>&#8220;Add DROP TABLE / DROP VIEW&#8221; will delete your table on import before recreating it.</p>
<p>Extended inserts and Complete insterts gives you a smaller file and more compacted, easy to read view.</p>
<p>Click &#8220;Save as file&#8221; and use &#8220;gzipped&#8221; compression for the smallest files.</p>
<p>In the File name template, I add %D, which spits out today&#8217;s date. I add a little hypen before to seperate it from the database name and MAMP after, so I know it was a local dump and not from my live server. This format would give me a file like: mysql-06_02_09_MAMP.sql.gz</p>
<p>To restore your databse, click on the import tab, click the browse button, select your file, press go. I&#8217;ll spare you the screenshot.</p>
<div id="bppostbookmarks"><a href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2009%2F06%2F02%2Fhow-to-back-up-databases-using-phpmyadmin&t=how+to+back+up+databases+using+phpMyAdmin" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/yahoo-icon.png" alt="Add to Yahoo" title="Add to Yahoo" /></a> <a href="http://www.google.com/bookmarks/mark?op=add&bkmk=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2009%2F06%2F02%2Fhow-to-back-up-databases-using-phpmyadmin&title=how+to+back+up+databases+using+phpMyAdmin" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/g-icon.png" alt="Add to Google" title="Add to Google" /></a> <a href="http://del.icio.us/post?&url=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2009%2F06%2F02%2Fhow-to-back-up-databases-using-phpmyadmin&title=how+to+back+up+databases+using+phpMyAdmin" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/delicious-icon.png" alt="Save to Del.icio.us" title="Save to Del.icio.us" /></a> <a href="http://digg.com/submit?phase=2&url=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2009%2F06%2F02%2Fhow-to-back-up-databases-using-phpmyadmin&title=how+to+back+up+databases+using+phpMyAdmin&bodytext=&topic=" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/digg-icon.png" alt="Digg IT!" title="Digg IT!" /></a> <a href="https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2009%2F06%2F02%2Fhow-to-back-up-databases-using-phpmyadmin&title=how+to+back+up+databases+using+phpMyAdmin&top=1" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/live-icon.gif" alt="Live Bookmarks!" title="Live Bookmarks!" /></a> </div>]]></content:encoded>
			<wfw:commentRss>http://andrewmallis.com/blog/2009/06/02/how-to-back-up-databases-using-phpmyadmin/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>JMA Consulting</title>
		<link>http://andrewmallis.com/blog/2009/04/16/jma-consulting</link>
		<comments>http://andrewmallis.com/blog/2009/04/16/jma-consulting#comments</comments>
		<pubDate>Thu, 16 Apr 2009 05:50:45 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://andrewmallis.com/blog/?p=173</guid>
		<description><![CDATA[I&#8217;ve been working with the firm JMA Consulting for a good number of months now. The firm does a lot of work for non-profits in the areas of citizen engagement and relationship management. They do a lot of work for the Ontario NDP, and organizations in the environmental and educational fields too. I&#8217;ve been doing [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working with the firm <a href="http://jmaconsulting.biz" title="JMA Consulting Homepage" target="_blank" class="liexternal">JMA Consulting</a> for a good number of months now. The firm does a lot of work for non-profits in the areas of citizen engagement and relationship management. They do a lot of work for the Ontario NDP, and organizations in the environmental and educational fields too.</p>
<p>I&#8217;ve been doing work implementing and configuring  <a href="http://civicrm.org/" title="more about CiviCRM" target="_blank" class="liexternal">CiviCRM</a>. Joe, the principal JMA, is on the advisory board, and many of his clients leverage this solution to manage their constituents.</p>
<p>I&#8217;ve also been doing a lot of sysadmin work: Linux server administration, Subversion repository managment, etc. Generally, I figure things out; make things work. I&#8217;m enjoying not being the lead on every project I work on, and it&#8217;s helping me achieve more balance in my life, I think.</p>
<div id="bppostbookmarks"><a href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2009%2F04%2F16%2Fjma-consulting&t=JMA+Consulting" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/yahoo-icon.png" alt="Add to Yahoo" title="Add to Yahoo" /></a> <a href="http://www.google.com/bookmarks/mark?op=add&bkmk=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2009%2F04%2F16%2Fjma-consulting&title=JMA+Consulting" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/g-icon.png" alt="Add to Google" title="Add to Google" /></a> <a href="http://del.icio.us/post?&url=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2009%2F04%2F16%2Fjma-consulting&title=JMA+Consulting" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/delicious-icon.png" alt="Save to Del.icio.us" title="Save to Del.icio.us" /></a> <a href="http://digg.com/submit?phase=2&url=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2009%2F04%2F16%2Fjma-consulting&title=JMA+Consulting&bodytext=&topic=" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/digg-icon.png" alt="Digg IT!" title="Digg IT!" /></a> <a href="https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2009%2F04%2F16%2Fjma-consulting&title=JMA+Consulting&top=1" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/live-icon.gif" alt="Live Bookmarks!" title="Live Bookmarks!" /></a> </div>]]></content:encoded>
			<wfw:commentRss>http://andrewmallis.com/blog/2009/04/16/jma-consulting/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>securing SSH under CentOS 5</title>
		<link>http://andrewmallis.com/blog/2008/03/18/securing-ssh-under-centos-5</link>
		<comments>http://andrewmallis.com/blog/2008/03/18/securing-ssh-under-centos-5#comments</comments>
		<pubDate>Tue, 18 Mar 2008 21:34:37 +0000</pubDate>
		<dc:creator>Andrew</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[tech tips]]></category>

		<guid isPermaLink="false">http://andrewmallis.com/blog/2008/03/18/securing-ssh-under-centos-5</guid>
		<description><![CDATA[I&#8217;ve recently started using Rimuhosting&#8217;s VPS services. The server is running CentOS 5 and bundled with a bunch of goodies. A VPS offers more control, but is also more susceptible to hacking attempts, and requires a bit of preventative medicine. This is just a log of my experiences setting up a more secure environment. Update [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently started using Rimuhosting&#8217;s VPS services. The server is running CentOS 5 and bundled with a bunch of goodies. A VPS offers more control, but is also more susceptible to hacking attempts, and requires a bit of preventative medicine. This is just a log of my experiences setting up a more secure environment.</p>
<p><span id="more-111"></span></p>
<h2>Update RMPs with APT</h2>
<p><a href="http://freshrpms.net/apt/" target="_blank" class="liexternal">APT</a> (Advanced Package Tool) is a  dependency tool originally developed for Debian, but packaged to work with <a href="http://www.rpm.org/" target="_blank" class="liexternal">RPM</a>s (Package Manager) and is similar to <a href="http://linux.duke.edu/projects/yum/" target="_blank" class="liexternal">YUM</a> (Yellowdog Updater Modified). APT commands connect to a repositoristory to not only install, or update requested packages, but also any required dependent packages. You can also keyword search the repository to find  packages based on functionality.</p>
<p>First things first,</p>
<pre># update the db of available rpms.
# Do this before running the other commands.
apt-get update

# upgrade currently installed rpms to the most stable version
apt-get upgrade</pre>
<p>I got a</p>
<pre>Resolving: The following packages have been kept back</pre>
<p>message, meaning that one of the updated packages has a dependency which does not currently exist on my system. and so ran</p>
<pre>apt-get dist-upgrade</pre>
<p>to install these new dependencies as well as update the package.</p>
<h2>Secure remote login</h2>
<h4>1. Run SSH daemon on a non-standard port</h4>
<p>Run SSHd on a non-standard port. Since most automated attacks only attempt to connect on (the standard) port 22, this can be an effective way to hide from many attackers. To configure this, just change the Port line in /etc/ssh/sshd_config. I was digging around trying to find <strong>pico</strong>, the text editor I&#8217;m used to. It wasn&#8217;t installed and wasn&#8217;t in the APT repository. I don&#8217;t like emacs or vi so much,  but a bit of google revealed that <strong>nano</strong> is exactly the same as pico.</p>
<p>Now, to connect via ssh I need to use the p switch, replacing 22 below the with the non-standard port number and user and password as required.</p>
<pre>ssh -p 22 user@servername</pre>
<p>I&#8217;ve set up the login as an alias in my <strong>.bash_profile</strong> (on my local machines). This new port has to be specified in the <strong>scp</strong> command too. Here is the format (note that the P switch needs to be uppercase here, and that 22 should be replaced with the non-standard port number):</p>
<pre>#copy a file
scp -P 22 local/path/filename.ext  user@remoteserver:/remote/path/

#copy a file and rename
scp -P 22 local/path/filename.ext \
    user@remoteserver:/remote/path/filename.ext

#copies a directory
scp -Pr 22 localdirectory  user@server.com:/remote/path/directory/</pre>
<h4>2. Use &#8216;hashlimit&#8217; in &#8216;iptables&#8217;</h4>
<p>Limits one connection to the SSH port from one IP address per minute with this rule via the command line.</p>
<pre>#change the port number to match SSH port
iptables -I INPUT -m hashlimit -m tcp -p tcp --dport 22 \
    --hashlimit 1/min --hashlimit-mode srcip \
    --hashlimit-name ssh -m state --state NEW -j ACCEPT</pre>
<p>Then, I set iptables to start at boot via the Webmin control panel (have to say I like Webmin way more than Plesk so far).</p>
<h4>3. Use a public-private key and disable password authentiification</h4>
<p>Even if you don&#8217;t disable password authentification in the end, you&#8217;ll be able to log into your server via SSH without typing your password every time with a public-private key pair. If you haven&#8217;t already generated an RSA private key, do so now.</p>
<pre>ssh-keygen -t rsa</pre>
<p>Next, you MUST copy your public key to the server before you can authorize it.</p>
<pre>scp -P 22 ~/.ssh/id_rsa.pub user@server.com:~/</pre>
<p>ssh to the server, replacing 22 with your non-standard port</p>
<pre>ssh -p 22 user@example.com</pre>
<p>Now append the public key to your authorized keys file and delete the file you uploaded. Only create the .ssh directory if it doesn&#8217;t already exist in your home folder:</p>
<pre>cd ~
mkdir .ssh
cat id_rsa.pub &gt;&gt; .ssh/authorized_keys
rm id_rsa.pub</pre>
<p>Now make sure permissions are set properly for all necessary files and directories. The go shortcut stands for <strong>g</strong>roup and <strong>o</strong>thers. In this case, we&#8217;re removing write priveliges on the home folder. The +, and &#8211; operators add or remove, = assigns. You can also use chmod a, where a stands for <strong>a</strong>ll users:</p>
<pre>chmod go-w ~
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys</pre>
<p>If everything is configured properly, you should be able to access your server account through SSH without a password now.</p>
<p>For ultimate protection against brute-force attacks, you can now set PasswordAuthentication to &#8216;no&#8217; by editing the <strong>sshd_config</strong> file</p>
<pre>nano /etc/ssh/sshd_config</pre>
<p>To disable password authentication just for root, use &#8216;PermitRootLogin without-password&#8217;.</p>
<h4>4. Restart SSH</h4>
<p>with this command (requires the absolute path).</p>
<pre>/etc/init.d/sshd restart</pre>
<p></p>
<h2> Install Denyhosts</h2>
<p>Denyhosts provides SSH attack (also known as dictionary based attacks and brute force attacks) prevention and is used by thousands of users worldwide and now has over 27,000 users contributing synchronization data. There is no RPM in the standard repo, neither YUM or APT worked at first.</p>
<p>Solution: use and external repository. The RPMForge guys provide stable, common packages which are missing from the main repos. I added their repositories to my sources by installing their latest RPM. Info here: <a href="http://dag.wieers.com/rpm/FAQ.php#B2" target="_blank" class="liexternal">http://dag.wieers.com/rpm/FAQ.php#B2</a>. I used this command:</p>
<pre>rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm</pre>
<p>then, ran</p>
<pre>yum update</pre>
<p>as I hadn&#8217;t before, and then</p>
<pre>yum install denyhosts</pre>
<p>though apt-get install would have worked equally well. I checked the instructions here <a href="http://denyhosts.sourceforge.net/ssh_config.html" target="_blank" class="liexternal">http://denyhosts.sourceforge.net/ssh_config.html</a> and confirmed that my shd server was compiled w/ tcp_wrappers support. That&#8217;s not all, though. The installer doesn&#8217;t actually do the whole job for you.</p>
<pre>#this is where the script looks for config details
mkdir /usr/share/denyhosts

#go there
cd /usr/share/denyhosts/

#Copy the sample configuration file to the real configuration file
cp /usr/share/doc/denyhosts-2.6/denyhosts.cfg-dist \
   /usr/share/denyhosts/denyhosts.cfg

#edit the config file
nano denyhosts.cfg</pre>
<p>Uncomment line 379, <strong>RESET_ON_SUCCESS = yes</strong> and set on  line 129, to accommodate my sticky fingers: <strong>DENY_THRESHOLD_ROOT = 3</strong>. We&#8217;ll get back to this file to enable synchronization mode.<strong><br />
</strong></p>
<pre>#make it possible for DenyHosts to run as a daemon
cp /usr/share/doc/denyhosts-2.6/daemon-control-dist \
   /usr/share/denyhosts/daemon-control

#edit the daemon config
nano daemon-control

#make sure that the daemon control script is executable (by root)
chown root:root daemon-control
chmod 700 daemon-control

#manually start denyhosts to make sure it's working
service denyhosts start

#Check the daemon log to ensure that
#DenyHosts is running successfully
nano /var/log/denyhosts

#Create a symbolic link from /etc/init.d
cd /etc/init.d
ln -s /usr/share/denyhosts/daemon-control denyhosts

#use chkconfig to ensure that DenyHosts runs at boot time
chkconfig --add denyhosts</pre>
<p>GREAT! Now let&#8217;s set up synchronization mode</p>
<pre>service denyhosts stop

#Now, configure the last section of the
#denyhosts.cfg file, then restart denyhosts
service denyhosts start

#Check the daemon log to ensure that
#DenyHosts is running successfully
nano /var/log/denyhosts</pre>
<p>Dance for joy! Take a break. That was a lot of work.</p>
<h2>Set up a Linux Firewall Using IPTables and Webmin</h2>
<p>I basically followed the instructions here: <a href="http://rimuhosting.com/howto/firewall.jsp" target="_blank" class="liexternal">http://rimuhosting.com/howto/firewall.jsp</a>. Worth noting: the &#8220;hashlimit in IPTables&#8221; rule previously mentioned needs to be committed and, upon doing so, makes you skip the default rule configuration as described on the Rimuhosting site. So, I went ahead and reset the firewall, implemented the defaults, clicked &#8220;Apply Configuration&#8221; then entered the my hashlimit rule via the command line again.</p>
<div id="bppostbookmarks"><a href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2008%2F03%2F18%2Fsecuring-ssh-under-centos-5&t=securing+SSH+under+CentOS+5" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/yahoo-icon.png" alt="Add to Yahoo" title="Add to Yahoo" /></a> <a href="http://www.google.com/bookmarks/mark?op=add&bkmk=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2008%2F03%2F18%2Fsecuring-ssh-under-centos-5&title=securing+SSH+under+CentOS+5" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/g-icon.png" alt="Add to Google" title="Add to Google" /></a> <a href="http://del.icio.us/post?&url=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2008%2F03%2F18%2Fsecuring-ssh-under-centos-5&title=securing+SSH+under+CentOS+5" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/delicious-icon.png" alt="Save to Del.icio.us" title="Save to Del.icio.us" /></a> <a href="http://digg.com/submit?phase=2&url=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2008%2F03%2F18%2Fsecuring-ssh-under-centos-5&title=securing+SSH+under+CentOS+5&bodytext=&topic=" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/digg-icon.png" alt="Digg IT!" title="Digg IT!" /></a> <a href="https://favorites.live.com/quickadd.aspx?marklet=1&mkt=en-us&url=http%3A%2F%2Fandrewmallis.com%2Fblog%2F2008%2F03%2F18%2Fsecuring-ssh-under-centos-5&title=securing+SSH+under+CentOS+5&top=1" target="_blank" class="liimagelink"><img src="http://andrewmallis.com/blog/wp-content/plugins/bp-bookmarks/images/live-icon.gif" alt="Live Bookmarks!" title="Live Bookmarks!" /></a> </div>]]></content:encoded>
			<wfw:commentRss>http://andrewmallis.com/blog/2008/03/18/securing-ssh-under-centos-5/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

