<?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>Anthony's Blog &#187; admin</title>
	<atom:link href="http://www.anthonyldechiaro.com/blog/archives/category/linux/admin/feed" rel="self" type="application/rss+xml" />
	<link>http://www.anthonyldechiaro.com/blog</link>
	<description>Thoughts, ideas, and ramblings of a crazed mind</description>
	<lastBuildDate>Fri, 05 Jun 2009 00:01:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Efficient file copying with pipeviewer and netcat</title>
		<link>http://www.anthonyldechiaro.com/blog/archives/323</link>
		<comments>http://www.anthonyldechiaro.com/blog/archives/323#comments</comments>
		<pubDate>Thu, 14 May 2009 18:17:32 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[netcat]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[pv]]></category>
		<category><![CDATA[raid]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tar]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=323</guid>
		<description><![CDATA[I couldn&#8217;t help myself anymore.  Newegg had 1 TB green drives on sale&#8230;  again, and my old ~1 TB storage array was nearly full.  Since my random computer parts are scattered about, I grabbed the only extra working machine I could find and threw the 4 drives into it.  Unfortunately for me the machine was [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I couldn&#8217;t help myself anymore.  Newegg had 1 TB green drives on sale&#8230;  again, and my old ~1 TB storage array was nearly full.  Since my random computer parts are scattered about, I grabbed the only extra working machine I could find and threw the 4 drives into it.  Unfortunately for me the machine was an old Athlon 64 3200+ so the RAID-5 syncing took some time (10+ hours, it was maxing out CPU at ~25MB/s).</p>
<p style="text-align: justify;">Now came the process of migrating the data over from my file server to the new array.  I didn&#8217;t want to fiddle with NFS or anything of that nature since I was booting off a Jaunty live CD.  SSH was certainly possible but then there was the overhead.  Rsync was another solution.  But then I recalled a extremely fast way with tar &amp; netcat.  Combine that with pipeviewer and you&#8217;ll get a fast transfer complete with verbose information.</p>
<p style="text-align: justify;">It&#8217;s very simple.  With two computers, source and dest, you simply run the following:</p>
<p style="text-align: justify;">On source (with IP 192.168.0.10):</p>
<pre style="text-align: justify;">tar -cf - /path | pv | nc -l -p 8888 -q 5</pre>
<p style="text-align: justify;">This will tar up /path and pipe it to netcat, which is listening on port 8888 for an incoming connection.</p>
<p style="text-align: justify;">On dest:</p>
<pre style="text-align: justify;">nc 192.168.0.10 | pv | tar -xf -</pre>
<p>Connect to source and pipe the output to tar for extraction.</p>
<p>Credit to Peteris&#8217; wonderful <a href="http://www.catonmat.net/blog/unix-utilities-pipe-viewer/" target="_blank">blog entry on pv</a>.</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=323" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/archives/323/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Repository Management</title>
		<link>http://www.anthonyldechiaro.com/blog/archives/311</link>
		<comments>http://www.anthonyldechiaro.com/blog/archives/311#comments</comments>
		<pubDate>Wed, 29 Apr 2009 01:19:38 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[apt-mirror]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[jaunty]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=311</guid>
		<description><![CDATA[For those of you who are unaware, the latest Ubuntu release &#8211; Jaunty &#8211; was released several days ago.  Normally, the fastest way to get the latest version is to torrent an ISO&#8230;  the repositories are so overloaded attempting to do an upgrade is not even remotely possible.  However, there is an alternative I stumbled [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">For those of you who are unaware, the latest Ubuntu release &#8211; <a href="http://www.ubuntu.com/getubuntu/download" target="_blank">Jaunty</a> &#8211; was released several days ago.  Normally, the fastest way to get the latest version is to <a href="http://www.ubuntu.com/getubuntu/downloadmirrors#bt" target="_blank">torrent an ISO</a>&#8230;  the repositories are so overloaded attempting to do an upgrade is not even remotely possible.  However, there is an alternative I stumbled upon.  Instead of using the default Ubuntu repositories, <a href="http://blog.techfun.org/how-to-select-the-fastest-ubuntu-repository-mirror" target="_blank">select the fastest mirror</a>, apt-get update, then upgrade away!  I was getting sustained rates of 300 KB/s without any issue during my upgrade.</p>
<p style="text-align: justify;">On a related note, I&#8217;ve considered tinkering with creating my own local repository mirror.  Not that I have nearly enough machines to make it necessary, but it would be an entertaining exercise.  Even found a <a href="http://www.howtoforge.com/local_debian_ubuntu_mirror" target="_blank">basic HOW-TO</a> or <a href="http://odzangba.wordpress.com/2007/12/24/use-apt-mirror-to-create-your-own-ubuntu-mirror/" target="_blank">two</a>.  However I have heard of potential issues: it can take weeks to fully mirror several distributitions (several GB each) and with an incomplete repository it would be somewhat pointless to use.  Luckily there seems to be an <a href="http://www.softwarefreedom.org/blog/2008/jan/24/apt-mirror-2/" target="_blank">easy solution with mod_rewrite</a>.</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=311" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/archives/311/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remote monitoring with apticron and logcheck</title>
		<link>http://www.anthonyldechiaro.com/blog/archives/272</link>
		<comments>http://www.anthonyldechiaro.com/blog/archives/272#comments</comments>
		<pubDate>Tue, 10 Mar 2009 19:27:13 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[reporting]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=272</guid>
		<description><![CDATA[I wanted to write a brief posting on some basic ways to help remotely administer Ubuntu/Debian boxes.  Over the past few months I&#8217;ve been tinkering with various methods of handling this and what I&#8217;ve come up with seems to work fairly well.  It basically consists of two applications: apticron, which monitors repositories for package updates, [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I wanted to write a brief posting on some basic ways to help remotely administer Ubuntu/Debian boxes.  Over the past few months I&#8217;ve been tinkering with various methods of handling this and what I&#8217;ve come up with seems to work fairly well.  It basically consists of two applications: apticron, which monitors repositories for package updates, and logcheck, which monitors logs in for any security or other noteworthy entries.</p>
<p style="text-align: justify;">Apticron is very easy to set up, it&#8217;s in the repositories and requires basically no configuration.  It will drop a script in /etc/cron.daily and that is about it, emailing any reports to root.  Of course this can be modified through a .forward or an entry in /etc/aliases.</p>
<p style="text-align: justify;">Logcheck is fairly simple to set up as well &#8211; it is also in the repositories.  Once installed, edit the /etc/logcheck/logcheck.conf file to configure.  The first thing you will want to set is the REPORTLEVEL setting, options are &#8220;workstation&#8221;, &#8220;server&#8221; (default value), or &#8220;paranoid&#8221;.  I use server on mine, which gives a good amount of detail. I would advise against using paranoid unless the server is extremely locked down and users do not typically login.  Workstation is good for a desktop environment.  The only other variable I edited was SENDMAILTO.  Logcheck works by basically comparing each  logentry against a set of regular expressions and generate a report if it does not match.  I had to modify one or two regex&#8217;s slightly to fix false positives, if you want my changes just ask and I&#8217;ll send them over.</p>
<p style="text-align: justify;">One other small gem I want to mention : <a href="http://members.dslextreme.com/users/billw/gkrellm/gkrellm.html" target="_blank">gkrellm</a>.  I use this on both my desktop and server, it is invaluable for providing real-time system performance metrics.  Sure, it does not have any logging capabilities and thus unsuitable in a large-scale environment but for keeping an eye on one or two boxes it fits the bill quite nicely.</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=272" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/archives/272/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top-like vmstat tool</title>
		<link>http://www.anthonyldechiaro.com/blog/archives/249</link>
		<comments>http://www.anthonyldechiaro.com/blog/archives/249#comments</comments>
		<pubDate>Fri, 09 Jan 2009 03:25:58 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=249</guid>
		<description><![CDATA[Another great little tool I came across &#8211; iotop.  It&#8217;s basically a top-like UI app that monitors the data from vmstat.  Only installed it recently but looks promising.
 ]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Another great little tool I came across &#8211; <a href="http://guichaz.free.fr/iotop/" target="_blank">iotop</a>.  It&#8217;s basically a top-like UI app that monitors the data from vmstat.  Only installed it recently but looks promising.</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=249" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/archives/249/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SMART Drive Health Follow-up</title>
		<link>http://www.anthonyldechiaro.com/blog/archives/245</link>
		<comments>http://www.anthonyldechiaro.com/blog/archives/245#comments</comments>
		<pubDate>Fri, 09 Jan 2009 03:18:42 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[data integrity]]></category>
		<category><![CDATA[disks]]></category>
		<category><![CDATA[smart]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=245</guid>
		<description><![CDATA[Just wanted to note that I recently discovered a nice graphical tool for checking SMART drive health status and even run self-tests from.  Quite handy.  Read more about it here at Ubuntu Unleashed.
 ]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Just wanted to note that I recently discovered a nice graphical tool for checking SMART drive health status and even run self-tests from.  Quite handy.  <a href="http://www.ubuntu-unleashed.com/2008/10/gsmartcontrol-hard-disk-drive-health.html">Read more about it here at Ubuntu Unleashed</a>.</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=245" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/archives/245/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debian chkconfig</title>
		<link>http://www.anthonyldechiaro.com/blog/archives/231</link>
		<comments>http://www.anthonyldechiaro.com/blog/archives/231#comments</comments>
		<pubDate>Tue, 06 Jan 2009 22:34:49 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[blurb]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=231</guid>
		<description><![CDATA[Simple question that was on my mind for some time &#8211; what is RedHat/Fedora&#8217;s chkconfig equivalent?  sysv-rc-conf is the answer.  Not installed by default, simple apt-get solves that.  Syntax is almost identical to what I remember.  However also keep in mind that runlevels are not necessarily the same across different distributions.  If my memory serves [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Simple question that was on my mind for some time &#8211; what is RedHat/Fedora&#8217;s chkconfig equivalent?  <strong>sysv-rc-conf</strong> is the answer.  Not installed by default, simple apt-get solves that.  Syntax is almost identical to what I remember.  However also keep in mind that runlevels are not necessarily the same across different distributions.  If my memory serves me correctly, runlevels 1 and 6 are the only that are guaranteed to be identical on all platforms, although 3 and 5 are usually multi-user mode without and with X respectively.  Hope this may help a few of you!</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=231" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/archives/231/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rsync removable eSATA Script</title>
		<link>http://www.anthonyldechiaro.com/blog/archives/217</link>
		<comments>http://www.anthonyldechiaro.com/blog/archives/217#comments</comments>
		<pubDate>Thu, 18 Dec 2008 21:42:53 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=217</guid>
		<description><![CDATA[Finally got together and uploaded my second rsync script I mentioned earlier in this posting.  Instead of mirroring one internal drive (all partitions) to another, this will copy contents of one path to the external drive, optionally delete old files on removable disk from the previous rsync and finally eject/spin-down the drive if wanted.
Download or [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Finally got together and uploaded my second rsync script I mentioned earlier in <a href="/blog/archives/182">this posting</a>.  Instead of mirroring one internal drive (all partitions) to another, this will copy contents of one path to the external drive, optionally delete old files on removable disk from the previous rsync and finally eject/spin-down the drive if wanted.</p>
<p><a href="http://www.anthonyldechiaro.com/files/rsync_esata_with_raid.sh">Download</a> or <a href="http://wiki.anthonyldechiaro.com/tiki-index.php?page=rsync_esata_with_raid.sh">wiki</a>.</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=217" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/archives/217/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rsync script update</title>
		<link>http://www.anthonyldechiaro.com/blog/archives/182</link>
		<comments>http://www.anthonyldechiaro.com/blog/archives/182#comments</comments>
		<pubDate>Tue, 16 Dec 2008 15:06:05 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=182</guid>
		<description><![CDATA[I&#8217;ve been using my rsync mirror script for a few weeks now and have implemented an additional one or two tweaks after deploying it on my desktop system as well.

Firstly, now you can you use the same script across multiple boxes &#8211; the UUIDs are configurable per hostname
A bug was fixed where the script would [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I&#8217;ve been using my <a href="/blog/archives/11">rsync mirror script</a> for a few weeks now and have implemented an additional one or two tweaks after deploying it on my desktop system as well.</p>
<ul style="text-align: justify;">
<li>Firstly, now you can you use the same script across multiple boxes &#8211; the UUIDs are configurable per hostname</li>
<li>A bug was fixed where the script would fail if the destination disks were not already mounted.</li>
<li>You can also customize the rsync invocation on a host-basis as well.  This was needed on my desktop machine where a /home account was mounted via NFS on a different file system causing IO errors and subsequently skipping the file deletion.</li>
</ul>
<p style="text-align: justify;">One final enhancement I want to add is the ability to spin the backup disk down after rsync is complete &#8211; this will not only help to increase drive life but also help reduce power use (however small it may be).  For some odd reason on my machines whenever I stop (umount, sync, then spin-down) an internal disk it works for a few seconds, then the drive spins back up again and I&#8217;m seeing ATA link reset messages as if it was just being plugged in.  External drives connected with eSATA seem to work just fine however.  Need to look into that more.</p>
<p style="text-align: justify;">Also shortly available:</p>
<ul style="text-align: justify;">
<li>A similar but different script I use for syncing my RAID storage array with an backup external drive connected via eSATA.  It&#8217;s a bit of a hack in some spots, but the nice thing is that it is almost fully automated.  Use this on a machine with one of those <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16817153071">eSATA docks</a> and you have a good way of making a quick backup of an array or disk.</li>
<li>Sample <a href="/blog/archives/150">service account</a> script implementation with the &#8216;chattr&#8217; command.</li>
</ul>
<p style="text-align: justify;"><a href="http://www.anthonyldechiaro.com/files/master_sync_root.sh">Download</a> or <a href="http://wiki.anthonyldechiaro.com/tiki-index.php?page=master_sync_root">wiki</a>.</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=182" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/archives/182/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Simple key-based SSH + service account HOWTO</title>
		<link>http://www.anthonyldechiaro.com/blog/archives/150</link>
		<comments>http://www.anthonyldechiaro.com/blog/archives/150#comments</comments>
		<pubDate>Thu, 04 Dec 2008 05:02:42 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[public keys]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=150</guid>
		<description><![CDATA[If you have read my brief posting Intrepid upgrade done I mentioned I would shorlty be implementing SSH keys for my systems.  This is a simple HOWTO to cover the steps I used.  In my case I&#8217;m implementing this only a small home network, please adjust as needed.  I will be setting up a key [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">If you have read my brief posting <a href="/blog/archives/130">Intrepid upgrade done</a> I mentioned I would shorlty be implementing SSH keys for my systems.  This is a simple HOWTO to cover the steps I used.  In my case I&#8217;m implementing this only a small home network, please adjust as needed.  I will be setting up a key for my primary user account plus an additional phrase-less key used for automation purposes.  This second key will act as a service account, restricted to running only a few particular applications and/or scripts.</p>
<ol>
<li style="text-align: justify;">Run <span style="text-decoration: underline;">ssh-keygen -t rsa</span>.  I specified a simple passphrase for general-purpose logins.  We will be adding the second phrase-less key later.
<pre>(adechiaro@desktop:pts/6)-(4/0 @ 17k)-(09:22 PM)
~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/adechiaro/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa.
Your public key has been saved in id_rsa.pub.
The key fingerprint is:
5d:34:f1:de:ad:be:ef:65:34:36:a4:0d:75:d6:3c:47 adechiaro@desktop
The key's randomart image is:
+--[ RSA 2048]----+
...
+-----------------+
(adechiaro@desktop:pts/6)-(4/0 @ 17k)-(9:22 PM)
~$ cat .ssh/id_rsa.pub
ssh-rsa &lt;key&gt; adechiaro@desktop</pre>
</li>
<li style="text-align: justify;">Any machine you want to be able to connect to with this key, login and copy the contents of your public key (<span style="text-decoration: underline;">id_rsa.pub</span>) to the <span style="text-decoration: underline;">authorized_keys</span> file.  These are all in your <span style="text-decoration: underline;">$HOME/.ssh/</span> directory.  There are various ways to do this: you could copy the file over with scp and cat/append it, you could remote in to the host and cut &amp; paste the data, if you had a large infrastructure you could use ssh-copy-id or similar custom script.  It&#8217;s up to you, something like what is below should work in the general case.  Also the &lt;key&gt; is your public key in base64 encoded format.
<pre>desktop:~$ scp .ssh/id_rsa.pub adechiaro@server:~
id_service.pub                           100%  399     0.4KB/s   00:00
desktop:~$ ssh adechiaro@server
server:~$ cat id_rsa.pub &gt;&gt; ~/.ssh/authorized_keys</pre>
</li>
<li style="text-align: justify;">Now for an example of making the key more secure, you can add additional options to the <span style="text-decoration: underline;">authorized_keys</span> file.  These come before the &#8220;ssh-rsa &lt;key&gt;&#8221; part of the entry (prefix the line with them): <span id="more-150"></span>
<ol>
<li><strong>from=&#8221;host1,host2,10.0.0.1&#8243; &#8211; </strong>This will prevent the key from authenticating except the hosts listed here, canonical name or IP.</li>
<li><strong>command=&#8221;/usr/local/bin/myscript.sh&#8221;, no-pty</strong> &#8211; Executes <strong>command</strong> upon login.  You might want to combine this with <strong>no-pty</strong> which prevents tty allocation (shell login) so you can securely execute a remote command and without granting direct login access (we will be doing this for our service account)</li>
<li>There are <strong><em>a lot</em></strong> of more options &#8211; read the sshd manpage under the authorized_keys section for more.</li>
</ol>
</li>
<li>Create the second public key saved with a different name.  Leave this with an empty passphrase as will be used for automation.
<pre>ssh-keygen -f id_service</pre>
</li>
<li style="text-align: justify;">You will need to either write a simple script or use an existing one for linking with this key.  This will be run every time the account is logged into, regardless of what command may be passed on the SSH command line (the command line arguments will be read by the script but not necessarily executed).  Here is a simple generic one I threw together for general purpose use (<a href="/files/service.sh">download</a> or <a href="http://wiki.anthonyldechiaro.com/tiki-index.php?page=service.sh">view in wiki</a>).   I do not make any promises this is completely bugfree/secure nor am I liable for any consequences!  If you use mine, you will want to configure the COMMANDS variable within the script.  These are the specific commands which the service account will be permitted to run.  A command specified on the SSH command line which does not match any entry in COMMANDS will not be run.  Also, make sure the file is <span style="text-decoration: underline;"><strong>chmod 500</strong></span> after you are done configuring it, it&#8217;s basically a homebrew sudoers file and vital no other users can read the contents.</li>
<li style="text-align: justify;">Copy your second key to the other machines as in step 2.  You will want to to prefix this new entry with <strong>&#8216;command=&#8221;/usr/local/bin/service.sh&#8221;, no-pty&#8217;</strong>, adjusting the path and script name as needed.  You may also want to specify <strong>&#8216;no-port-forwarding,no-X11-forwarding&#8217;</strong> as additional security measures.</li>
<li style="text-align: justify;">Done!</li>
</ol>
<p>Now to run, simply connect via ssh.  It will default to your id_rsa key:</p>
<pre>desktop:~$ ssh adechiaro@server
Enter passphrase for key '/home/adechiaro/.ssh/id_rsa':
server:~$</pre>
<p>If you want to use your service account in a script, call it in the following manner:</p>
<pre>desktop:~$ ssh adechiaro@server -i ~/.ssh/id_service /usr/bin/whoami
Executing command: "/usr/bin/whoami"
adechiaro
desktop:~$ ssh adechiaro@server -i ~/.ssh/id_service /bin/hostname
Executing command: "/bin/hostname"
server
desktop:~$</pre>
<p style="text-align: justify;">We need to specify the full path to the key in this case.  Replace whoami or hostname with whatever script/app you want to run and assuming you pre-configured it the service.sh script correctly, it should run just fine without prompting you for the passphrase.  Please feel free to leave any question and/or comments.</p>
<h5 style="text-align: justify;"><span style="text-decoration: underline;"><strong>References:</strong></span></h5>
<h5 style="text-align: justify;"><a href="http://www.securityfocus.com/infocus/1810">http://www.securityfocus.com/infocus/1810</a><br />
<a href="http://standalone-sysadmin.blogspot.com/2008/11/host-to-host-security-with-ssh-keys.html">http://standalone-sysadmin.blogspot.com/2008/11/host-to-host-security-with-ssh-keys.html</a><br />
<a href="http://standalone-sysadmin.blogspot.com/2008/11/wacky-ssh-authorized-keys-tricks.htm">http://standalone-sysadmin.blogspot.com/2008/11/wacky-ssh-authorized-keys-tricks.htm</a>l<br />
<a href="http://it.toolbox.com/blogs/unix-sysadmin/playing-with-openssh-public-keys-28377">http://it.toolbox.com/blogs/unix-sysadmin/playing-with-openssh-public-keys-28377</a><br />
<a href="http://blog.funnelfiasco.com/?p=44">http://blog.funnelfiasco.com/?p=44</a></h5>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=150" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/archives/150/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitoring drive health with SMART</title>
		<link>http://www.anthonyldechiaro.com/blog/archives/143</link>
		<comments>http://www.anthonyldechiaro.com/blog/archives/143#comments</comments>
		<pubDate>Wed, 26 Nov 2008 22:34:31 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[admin]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[data integrity]]></category>
		<category><![CDATA[disks]]></category>
		<category><![CDATA[smart]]></category>

		<guid isPermaLink="false">http://www.anthonyldechiaro.com/blog/?p=143</guid>
		<description><![CDATA[So after installing Intrepid on my new new Acer Aspire One netbook, I was working with SMART to resolving the Load_Cycle_Count issue (hard drive killer bug).  Once that was done I figured it would make sense to check the SMART health status of the rest of the drives in my desktops and server.  Good thing [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">So after installing Intrepid on my new new Acer Aspire One <a href="http://www.newegg.com/Product/Product.aspx?Item=N82E16834115499&amp;Local=y">netbook</a>, I was working with SMART to resolving the <a href="http://ubuntuforums.org/showthread.php?t=805570">Load_Cycle_Count</a> issue (hard drive killer bug).  Once that was done I figured it would make sense to check the SMART health status of the rest of the drives in my desktops and server.  Good thing I did too&#8230;  results varied to a few counts of <span style="text-decoration: underline;">UDMA CRC Error Count</span> to having hundreds of thousands of <span style="text-decoration: underline;">Hardware ECC Recovered</span>, <span style="text-decoration: underline;">Raw Read Error Rate</span>, and <span style="text-decoration: underline;">Seek Error Rates</span>.  The RAID drives in my server had a few million counts of <span style="text-decoration: underline;">Seek Error Rate</span> as well.  However I did run self-tests and all came back passed so it is something I am going to keep a close eye on (GkrellM plugin perhaps?)</p>
<p style="text-align: justify;">According to a few <a href="http://www.captain.at/howto-linux-smartmontools-smartctl.php">different</a> <a href="http://cuddletech.com/blog/pivot/entry.php?id=993">sources</a> there are a few of the attributes which are important to watch, although opinions can vary slightly.  You can also get descriptions of each attribute <a href="http://smartlinux.sourceforge.net/smart/attributes.php">here</a>.  Also keep in mind I&#8217;m taking RAW_VALUE here, this Linux Journal <a href="http://www.linuxjournal.com/article/6983">article</a> helps explain the difference between VALUE/WORST/THRESH/RAW values, however the data can be a little difficult to interpret (I usually stick with RAW).  Basically the best idea here is to keep current backups (a whole book can be written about those alone) and to schedule regular SMART self-tests for all your drives.  I used the following configuration in <span style="text-decoration: underline;">/etc/smartd.conf</span>:</p>
<pre>/dev/sda -a -o on -S on -s (S/../.././12|L/../../3/1) -m root
/dev/sdb -a -o on -S on -s (S/../.././12|L/../../3/3) -m root</pre>
<p style="text-align: justify;">This will configure regular &#8217;short&#8217; scans at noon daily, and &#8216;long&#8217; scans at 1 and 3 pm on Wednesdays.  Other parameters provide more verbose and frequent information (<strong>-a</strong>) and enabling autosave (<strong>-S</strong>) and automatic offline (<strong>-o</strong>).  -m simply tells to mail any warnings (if found) to root.  -M will do the same but send all reports instead of just warnings.</p>
<p style="text-align: justify;"><span style="text-decoration: underline;"><strong>Update (Dec 05)</strong></span><strong>:</strong> Note &#8211; this is <strong>important</strong>.  Depending upon your distribution, you may need to modify your <span style="text-decoration: underline;">/etc/default/smartmontools</span> file.  On my Intrepid boxes I needed to uncomment the line <strong>&#8220;start_smartd=yes&#8221;</strong>.  Without it, smartd would not start up automatically and furthermore any attempts to start it would silently fall back to the prompt without any error message.  I was wondering why my automated selftests were not being run&#8230;</p>
 <img src="http://www.anthonyldechiaro.com/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=143" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.anthonyldechiaro.com/blog/archives/143/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
