<?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>jon zobrist (dot) com &#187; ssh</title>
	<atom:link href="http://www.jonzobrist.com/tag/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jonzobrist.com</link>
	<description>Unix, Linux, IT, Cloud, Meat</description>
	<lastBuildDate>Fri, 06 Jan 2012 18:59:34 +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>LCOD – 5.26.10 – Compare 2 directories</title>
		<link>http://www.jonzobrist.com/2010/05/26/lcod-5-26-10-compare-2-directories/</link>
		<comments>http://www.jonzobrist.com/2010/05/26/lcod-5-26-10-compare-2-directories/#comments</comments>
		<pubDate>Wed, 26 May 2010 22:50:04 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[compare]]></category>
		<category><![CDATA[md5]]></category>
		<category><![CDATA[md5sum]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[sync]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/2010/05/26/lcod-5-26-10-compare-2-directories/</guid>
		<description><![CDATA[
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F05%2F26%2Flcod-5-26-10-compare-2-directories%2F' data-shr_title='LCOD+%E2%80%93+5.26.10+%E2%80%93+Compare+2+directories'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F05%2F26%2Flcod-5-26-10-compare-2-directories%2F' data-shr_title='LCOD+%E2%80%93+5.26.10+%E2%80%93+Compare+2+directories'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>md5sum * | md5sum</p>
<p>This will return an md5sum which will look something like<br />
9277826461d2cb19731f6201c6b2c6b3  -</p>
<p>Run it in 2 directories, if the sums of the sums match, the files are identical.<br />
If not, you may want to rsync between them with something like<br />
rsync-avz -e ssh localdir/ user@remotehost:/remotedir/<br />
or<br />
rsync-avz -e ssh user@remotehost:/remotedir/ localdir/</p>
<div class="shr-publisher-125"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F05%2F26%2Flcod-5-26-10-compare-2-directories%2F' data-shr_title='LCOD+%E2%80%93+5.26.10+%E2%80%93+Compare+2+directories'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F05%2F26%2Flcod-5-26-10-compare-2-directories%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2010%2F05%2F26%2Flcod-5-26-10-compare-2-directories%2F' data-shr_title='LCOD+%E2%80%93+5.26.10+%E2%80%93+Compare+2+directories'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2010/05/26/lcod-5-26-10-compare-2-directories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LCOD &#8211; 5.17.08 &#8211; Locking down ssh access</title>
		<link>http://www.jonzobrist.com/2008/05/17/lcod-5-17-08-locking-down-ssh-access/</link>
		<comments>http://www.jonzobrist.com/2008/05/17/lcod-5-17-08-locking-down-ssh-access/#comments</comments>
		<pubDate>Sun, 18 May 2008 05:46:10 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=90</guid>
		<description><![CDATA[In light of an increase in ssh attacks , vulnerabilities and scans I am writing this guide to help you keep unwanted people from connecting to your server via SSH. If you have generated any of your SSH keys on a Debian or Ubuntu system they are likely very vulnerable to guessing, e.g. someone could [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F05%2F17%2Flcod-5-17-08-locking-down-ssh-access%2F' data-shr_title='LCOD+-+5.17.08+-+Locking+down+ssh+access+'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F05%2F17%2Flcod-5-17-08-locking-down-ssh-access%2F' data-shr_title='LCOD+-+5.17.08+-+Locking+down+ssh+access+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>In light of an increase in ssh attacks , vulnerabilities  and scans  I am writing this guide to help you keep unwanted people from connecting to your server via SSH.</p>
<p>If you have generated any of your SSH keys on a Debian or Ubuntu system they are likely very vulnerable to guessing, e.g. someone could login to your box if they know the name of one of your users that you allow in via ssh within 30 minutes!<br />
See here for more info: http://metasploit.com/users/hdm/tools/debian-openssl/</p>
<p>This applies to any PAM enabled Linux (or other PAM-enabled *nix like OS)</p>
<p>This guide will walk you through configuring your OpenSSH server to only allow public key authentication and limit that to specific users and groups. Errors in this guide or mistakes or differences in system configurations could lock you out of your own systems, be very careful and do not proceed unless you understand and assume the risk you are taking.</p>
<p>I assume no responsibility for YOUR actions. This guide was tested on Ubuntu 7.10 and fairly recent Gentoo system.</p>
<p>1. Limit SSH access to public/private keys only, deny X11 and TCP forwarding, and deny root ssh access<br />
Step 1 Discussion:<br />
Public/Private keys are not necessarily more secure than passwords, but it&#8217;s harder to  guess a private key, and if your users put passwords on their keys then an attacker must have or guess 2 things, the key and its password.</p>
<p>The root user is GOD on almost every Linux/*nix system out there, and nobody should be able to login directly as root remotely. In addition it&#8217;s a very common user, on almost every Linux/*nix system.</p>
<p>TCP and X11 forwarding is one of the coolest features of an ssh server. Unless you want people to be able to use your ssh server like a full access vpn to your local network, or any other network (bounce their attacks through your server), then you want this disabled. And X11 forwarding is great, but I never run an X11 server on something that is a &#8220;production&#8221; environment. If something requires an X11 server, like Oracle, then I run vncserver and allow ssh port forwarding so people can connect via ssh. I make sure to have full deny by default firewalls on all machines like this, limiting outbound access.</p>
<p>Step 1 HOWTO<br />
Edit /etc/ssh/sshd_config<br />
Make sure the following lines are not commented out, and don&#8217;t say something different</p>
<p>Protocol 2<br />
PermitRootLogin no<br />
UsePAM yes<br />
PasswordAuthentication no<br />
PubkeyAuthentication yes<br />
RSAAuthentication yes<br />
PermitEmptyPasswords no<br />
ChallengeResponseAuthentication no<br />
AllowTcpForwarding no<br />
X11Forwarding no</p>
<p>2. Create an ssh remote users group and add users to it who need remote ssh access<br />
Step 2 Discussion:<br />
The main reason I want to limit who has remote ssh access is because there are frequently system accounts or other automatically created accounts that I don&#8217;t want to have to monitor to make sure the installer didn&#8217;t just make a new user with a simple password or key. I want to have the default be nobody can ssh, and then I&#8217;ll add ssh permissions to users who need it.</p>
<p>Step 2 HOWTO:<br />
Let&#8217;s call our remote ssh users list rsshusers, we create it with the command<br />
groupadd rsshusers<br />
Now let&#8217;s say we have a user named mikey already setup, let&#8217;s add him to our new rsshusers group, with the command<br />
usermod -a -G rsshusers mikey<br />
Do this for every user you want to have ssh in remotely. Note that if you&#8217;re used to logging in remotely as root and are going to stop doing that, make sure you user can su to root with the command su.<br />
Login as the user, run<br />
su<br />
Put in your root password, if it accepts it and you are root (run whoami to verify) then you&#8217;re good to go. If it fails to let you su and you&#8217;re sure you have the password right you may need to be in the wheel group to us (default on FreeBSD and Gentoo).<br />
Back as root run the following command to add your user (again, mikey in this example) to your wheel group.<br />
usermod -a -G wheel mikey</p>
<p>Now we&#8217;re going to edit 2 files to limit remote ssh users to the group we made called rsshusers.<br />
First, edit /etc/pam.d/sshd (this was ssh on my Debian/Ubuntu systems)<br />
Add the line<br />
account    required     pam_access.so</p>
<p>This enables access accounting based on the /etc/security/access.conf file, which is the next one we are going to edit.<br />
On both my Gentoo and Debian system this file had every line commented out.<br />
At the end I added the following lines.</p>
<p>-:ALL EXCEPT root mikey:LOCAL<br />
+ : (rsshusers) : ALL<br />
- : ALL : ALL</p>
<p>Initially I tried to use a group like @rsshusers, however this didn&#8217;t seem to work, but () designates explicitly a group.</p>
<p>Restart sshd<br />
Gentoo:<br />
/etc/init.d/sshd restart<br />
Debian/Ubuntu:<br />
/etc/init.d/ssh restart</p>
<p>Now, without closing your root terminal, open a new one and make sure you can ssh in as mikey, and su to root.</p>
<p>Assuming everything went well you could try ssh&#8217;ing in as another user whose public key is correctly in place, but who isn&#8217;t in the rsshusers group.</p>
<p>Related links:</p>
<p>PAM:</p>
<p>http://devmanual.gentoo.org/tasks-reference/pam/index.html</p>
<p>http://linuxdocs.org/HOWTOs/User-Authentication-HOWTO/x101.html</p>
<p>http://tldp.org/HOWTO/User-Authentication-HOWTO/</p>
<p>http://www.faqs.org/docs/Linux-HOWTO/Secure-Programs-HOWTO.html</p>
<p>OpenSSH:</p>
<p>http://www.openssh.com/</p>
<p>http://thinkhole.org/wp/2006/10/30/five-steps-to-a-more-secure-ssh/</p>
<p>http://www.cyberciti.biz/tips/rhel-centos-linux-install-configure-rssh-shell.html</p>
<p>http://geekzine.org/2007/09/28/easy-sftp-and-chroot-sftp-with-scponly/</p>
<p>Misc:<br />
Securing RedHat</p>
<p>http://help.unc.edu/?id=1859</p>
<p>Debian SSLkeys</p>
<p>http://wiki.debian.org/SSLkeys</p>
<p>Links in post:</p>
<p>http://www.securityfocus.com/news/11518</p>
<p>http://metasploit.com/users/hdm/tools/debian-openssl/</p>
<div class="shr-publisher-90"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F05%2F17%2Flcod-5-17-08-locking-down-ssh-access%2F' data-shr_title='LCOD+-+5.17.08+-+Locking+down+ssh+access+'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F05%2F17%2Flcod-5-17-08-locking-down-ssh-access%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2008%2F05%2F17%2Flcod-5-17-08-locking-down-ssh-access%2F' data-shr_title='LCOD+-+5.17.08+-+Locking+down+ssh+access+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2008/05/17/lcod-5-17-08-locking-down-ssh-access/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LCOD &#8211; 6.6.07 &#8211; Simple SSH remote command execution</title>
		<link>http://www.jonzobrist.com/2007/06/06/lcod-6-6-07-simple-ssh-remote-command-execution/</link>
		<comments>http://www.jonzobrist.com/2007/06/06/lcod-6-6-07-simple-ssh-remote-command-execution/#comments</comments>
		<pubDate>Thu, 07 Jun 2007 05:37:27 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=77</guid>
		<description><![CDATA[ssh -X -C -f HOSTNAME PROGRAM Of course you need to be running an X server (Linux/*BSD Desktop) on your client, and you need to have ForwardX11 yes or ForwardX11Trusted yes in your CLIENT&#8217;s /etc/ssh/ssh_config file and X11Forwarding yes in /etc/ssh/sshd_config on the SERVER. No related posts. Related posts brought to you by Yet Another [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2007%2F06%2F06%2Flcod-6-6-07-simple-ssh-remote-command-execution%2F' data-shr_title='LCOD+-+6.6.07+-+Simple+SSH+remote+command+execution+'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2007%2F06%2F06%2Flcod-6-6-07-simple-ssh-remote-command-execution%2F' data-shr_title='LCOD+-+6.6.07+-+Simple+SSH+remote+command+execution+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p>ssh -X -C -f HOSTNAME PROGRAM</p>
<p>Of course you need to be running an X server (Linux/*BSD Desktop) on your client, and you need to have<br />
 ForwardX11 yes<br />
or<br />
 ForwardX11Trusted yes</p>
<p>in your CLIENT&#8217;s /etc/ssh/ssh_config file<br />
and<br />
X11Forwarding yes<br />
in /etc/ssh/sshd_config<br />
on the SERVER.</p>
<div class="shr-publisher-77"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2007%2F06%2F06%2Flcod-6-6-07-simple-ssh-remote-command-execution%2F' data-shr_title='LCOD+-+6.6.07+-+Simple+SSH+remote+command+execution+'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2007%2F06%2F06%2Flcod-6-6-07-simple-ssh-remote-command-execution%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2007%2F06%2F06%2Flcod-6-6-07-simple-ssh-remote-command-execution%2F' data-shr_title='LCOD+-+6.6.07+-+Simple+SSH+remote+command+execution+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2007/06/06/lcod-6-6-07-simple-ssh-remote-command-execution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LCOD &#8211; 8.10.05 &#8211; How to net backup/restore using tar&#124;ssh&#124;dd</title>
		<link>http://www.jonzobrist.com/2005/08/10/lcod-8-10-05-how-to-net-backuprestore-using-tarsshdd/</link>
		<comments>http://www.jonzobrist.com/2005/08/10/lcod-8-10-05-how-to-net-backuprestore-using-tarsshdd/#comments</comments>
		<pubDate>Thu, 11 Aug 2005 05:08:57 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tar]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=48</guid>
		<description><![CDATA[Ok, so you read the dd LCOD and tried it out, but you have a 250GB drive and only about 10GB data.. so you&#8217;d prefer if you only read the files that were actually there, and not your 100GB of deleted data. Well, here&#8217;s what I do. On the computer to be backed up I [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2005%2F08%2F10%2Flcod-8-10-05-how-to-net-backuprestore-using-tarsshdd%2F' data-shr_title='LCOD+-+8.10.05+-+How+to+net+backup%2Frestore+using+tar%7Cssh%7Cdd+'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2005%2F08%2F10%2Flcod-8-10-05-how-to-net-backuprestore-using-tarsshdd%2F' data-shr_title='LCOD+-+8.10.05+-+How+to+net+backup%2Frestore+using+tar%7Cssh%7Cdd+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p><span>Ok, so you read the dd LCOD and tried it out, but you have a 250GB drive and only about 10GB data.. so you&#8217;d prefer if you only read the files that were actually there, and not your 100GB of deleted data.</p>
<p>Well, here&#8217;s what I do. On the computer to be backed up I boot a linux live cd (such as knoppix from knopper.net), and mount the disks, on say, /mnt/disk and since I use gentoo I have /boot seperate and mount it on /mnt/disk/boot, so I only have to take 1 image/backup.</p>
<p>Then I make sure networking is up.. it all goes something like this<br />
</span></p>
<table border="0" cellspacing="1" cellpadding="3" width="90%" align="center">
<tbody>
<tr>
<td><span><strong>Code:</strong></span></td>
</tr>
<tr>
<td>mkdir /mnt/disk<br />
mount /dev/hda3 /mnt/disk<br />
mount /dev/hda1 /mnt/disk/boot<br />
cd /mnt/disk<br />
tar -zcvf &#8211; * | ssh   <script type="text/javascript">// <![CDATA[// <![CDATA[
 var prefix = '&#109;a' + 'i&#108;' + '&#116;o';
 var path = 'hr' + 'ef' + '=';
 var addy50691 = '&#117;s&#101;r' + '&#64;';
 addy50691 = addy50691 + '192' + '&#46;' + '168' + '&#46;' + '0' + '&#46;' + 'X';
 var addy_text50691 = '&#117;s&#101;r' + '&#64;' + '192' + '&#46;' + '168' + '&#46;' + '0' + '&#46;' + 'X';
 document.write( '<a ' + path + '\'' + prefix + ':' + addy50691 + '\'>' );
 document.write( addy_text50691 );
 document.write( '<\/a>' );
 //\n 
// --&gt;]]&gt;</script><a href="mailto:user@192.168.0.X">user@192.168.0.X</a><script type="text/javascript">// <![CDATA[// <![CDATA[
 document.write( '<span style="\" mce_style="\"'display: none;\'>' );
// ]]&gt;</script><span style="display: none;">This e-mail address is being protected from spam bots, you need JavaScript enabled to view it  <script type="text/javascript">// <![CDATA[// <![CDATA[
 document.write( '</' );
 document.write( 'span>' );
// ]]&gt;</script></span> dd of=/home/user/backup.tar.gz</td>
</tr>
</tbody>
</table>
<p><span></p>
<p>Then we get the prompt to accept the key, put in our password and wait. The v in the -zcvf will give us verbose output, if you just want to wait you can omit it and not see each file as it goes. This will create a tar archive of all the files in that directory, gzip it and put it to standard out, which redirects to ssh to 192.168.0.X as user &#8220;user&#8221;, and then pipes it to the dd which puts it into the file /home/user/bakcup.tar.gz</p>
<p>Now, on to the restore part&#8230; So you have this image, and you want to put it onto another computer.. Well this is kind of like installing gentoo, so boot to your trusty linux cd, open a console and follow these steps..<br />
create your partitions using fdisk (here&#8217;s an fdisk howto <a href="http://www.tldp.org/HOWTO/Partition/partition-5.html" target="_blank">http://www.tldp.org/HOWTO/Partition/partition-5.html</a>)</p>
<p>Now I&#8217;m going to assume you&#8217;ve made /dev/hda1 as your /boot /dev/hda2 as your swap and /dev/hda3 as your / (root) partition.</p>
<p>To format your disks use the mkfs commands like this<br />
</span></p>
<table border="0" cellspacing="1" cellpadding="3" width="90%" align="center">
<tbody>
<tr>
<td><span><strong>Code:</strong></span></td>
</tr>
<tr>
<td>
mke2fs /dev/hda1<br />
mkreiserfs /dev/hda3<br />
mkswap /dev/hda2</td>
</tr>
</tbody>
</table>
<p><span></p>
<p>now that you have your disks setup, lets mount them, its just like above is we use /mnt/disk as the mount point, and run our restore, which is just like the above command but reversed&#8230; note you could probably use cat instead of dd&#8230; and a &gt; instead of dd on the creating side above..</p>
<p></span></p>
<table border="0" cellspacing="1" cellpadding="3" width="90%" align="center">
<tbody>
<tr>
<td><span><strong>Code:</strong></span></td>
</tr>
<tr>
<td>mkdir /mnt/disk<br />
mount /dev/hda3 /mnt/disk<br />
mkdir /mnt/disk/boot<br />
mount /dev/hda1 /mnt/disk/boot<br />
swapon /dev/hda2<br />
cd /mnt/disk<br />
ssh   <script type="text/javascript">// <![CDATA[// <![CDATA[
 var prefix = '&#109;a' + 'i&#108;' + '&#116;o';
 var path = 'hr' + 'ef' + '=';
 var addy50691 = '&#117;s&#101;r' + '&#64;';
 addy50691 = addy50691 + '192' + '&#46;' + '168' + '&#46;' + '0' + '&#46;' + 'X';
 var addy_text50691 = '&#117;s&#101;r' + '&#64;' + '192' + '&#46;' + '168' + '&#46;' + '0' + '&#46;' + 'X';
 document.write( '<a ' + path + '\'' + prefix + ':' + addy50691 + '\'>' );
 document.write( addy_text50691 );
 document.write( '<\/a>' );
 //\n 
// --&gt;]]&gt;</script><a href="mailto:user@192.168.0.X">user@192.168.0.X</a><script type="text/javascript">// <![CDATA[// <![CDATA[
 document.write( '<span style="\" mce_style="\"'display: none;\'>' );
// ]]&gt;</script><span style="display: none;">This e-mail address is being protected from spam bots, you need JavaScript enabled to view it  <script type="text/javascript">// <![CDATA[// <![CDATA[
 document.write( '</' );
 document.write( 'span>' );
// ]]&gt;</script></span> dd if=/home/user/backup.tar.gz | tar -zxvpf  -</td>
</tr>
</tbody>
</table>
<p><span></p>
<p>note: the &#8211; at the end of the the tar command means standard in/out</p>
<p>So now you&#8217;ve got your data restored exactly as the system was at last shutdown, on a new file system. If you changed your disk layout, you&#8217;ll want to update /etc/fstab and the final thing we need to do is reinstall grub so the system boots to it. To do that we need to chroot, just like a gentoo install<br />
assuming your disks are still mounted on /mnt/disk<br />
</span></p>
<table border="0" cellspacing="1" cellpadding="3" width="90%" align="center">
<tbody>
<tr>
<td><span><strong>Code:</strong></span></td>
</tr>
<tr>
<td>
chroot /mnt/disk /bin/bash<br />
grub<br />
root (hd0,0)<br />
setup (hd0)</td>
</tr>
</tbody>
</table>
<p><span></p>
<p>Assuming your disk is 0,0 (first IDE drive, slice is /boot)<br />
You can use the tab key in grub to see what disks are available, so type root (hd<br />
and hit tab<br />
and it&#8217;ll say 0,1,2 or something telling you which disks are available</p>
<p>That&#8217;s it, now exit the shell and reboot like this<br />
</span></p>
<table border="0" cellspacing="1" cellpadding="3" width="90%" align="center">
<tbody>
<tr>
<td><span><strong>Code:</strong></span></td>
</tr>
<tr>
<td>
exit<br />
cd /<br />
umount /mnt/disk/boot<br />
umount /mnt/disk<br />
swapoff /dev/hda2<br />
reboot</td>
</tr>
</tbody>
</table>
<p><span></p>
<p>don&#8217;t forget to remove the CDROM when you reboot (knoppix will eject it and ask you to hit enter once its out)</p>
<p>Now you should get your old OS booted back up, FYI if you&#8217;re imaging lots of systems you may want to edit your config files for your network if you&#8217;re not using DHCP (/etc/conf.d/net on gentoo) so the machines don&#8217;t all try to come up with the same IP address.</p>
<p></span></p>
<hr /><span>When imaging systems with server services, specifically SSH, is that you should change your server key, in fact, it&#8217;d be best if you deleted your keys BEFORE you created your image, so that when the server boots up it&#8217;ll generate its own keys upon starting SSH. Having your SSH private keys in any type of unsecure location is a BAD idea&#8230;</p>
<p>to delete your keys simply<br />
</span></p>
<table border="0" cellspacing="1" cellpadding="3" width="90%" align="center">
<tbody>
<tr>
<td><span><strong>Code:</strong></span></td>
</tr>
<tr>
<td>
/bin/rm /etc/ssh/*key*</td>
</tr>
</tbody>
</table>
<div class="shr-publisher-48"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2005%2F08%2F10%2Flcod-8-10-05-how-to-net-backuprestore-using-tarsshdd%2F' data-shr_title='LCOD+-+8.10.05+-+How+to+net+backup%2Frestore+using+tar%7Cssh%7Cdd+'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2005%2F08%2F10%2Flcod-8-10-05-how-to-net-backuprestore-using-tarsshdd%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2005%2F08%2F10%2Flcod-8-10-05-how-to-net-backuprestore-using-tarsshdd%2F' data-shr_title='LCOD+-+8.10.05+-+How+to+net+backup%2Frestore+using+tar%7Cssh%7Cdd+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2005/08/10/lcod-8-10-05-how-to-net-backuprestore-using-tarsshdd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LCOD &#8211; 4.25.05 &#8211; Howto get out of hung SSH sessions</title>
		<link>http://www.jonzobrist.com/2005/04/25/lcod-4-25-05-howto-get-out-of-hung-ssh-sessions/</link>
		<comments>http://www.jonzobrist.com/2005/04/25/lcod-4-25-05-howto-get-out-of-hung-ssh-sessions/#comments</comments>
		<pubDate>Tue, 26 Apr 2005 05:04:58 +0000</pubDate>
		<dc:creator>Jon Zobrist</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Linux Command of the Day]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://jonzobrist.com/?p=42</guid>
		<description><![CDATA[~. That&#8217;s it! If you&#8217;re in a system and your modem dropped, or your DSL hung, or your connection just got lost and ssh didn&#8217;t kick you back to your prompt, just hit ~. and you&#8217;ll disconnect. Again that&#8217;s Tilde (~) and then period (.) If you&#8217;re in multiple systems in a chain of SSH [...]
No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2005%2F04%2F25%2Flcod-4-25-05-howto-get-out-of-hung-ssh-sessions%2F' data-shr_title='LCOD+-+4.25.05+-+Howto+get+out+of+hung+SSH+sessions+'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2005%2F04%2F25%2Flcod-4-25-05-howto-get-out-of-hung-ssh-sessions%2F' data-shr_title='LCOD+-+4.25.05+-+Howto+get+out+of+hung+SSH+sessions+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetTop Automatic --><p><span>~.</p>
<p>That&#8217;s it! If you&#8217;re in a system and your modem dropped, or your DSL hung, or your connection just got lost and ssh didn&#8217;t kick you back to your prompt, just hit ~. and you&#8217;ll disconnect.</p>
<p>Again that&#8217;s Tilde (~) and then period (.)</p>
<p>If you&#8217;re in multiple systems in a chain of SSH connections this will disconnect you from the one your local machine is connected to.</span></p>
<div class="shr-publisher-42"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><div class='shareaholic-like-buttonset' style='float:none;height:30px;'><a class='shareaholic-fblike' data-shr_layout='button_count' data-shr_showfaces='false' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2005%2F04%2F25%2Flcod-4-25-05-howto-get-out-of-hung-ssh-sessions%2F' data-shr_title='LCOD+-+4.25.05+-+Howto+get+out+of+hung+SSH+sessions+'></a><a class='shareaholic-fbsend' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2005%2F04%2F25%2Flcod-4-25-05-howto-get-out-of-hung-ssh-sessions%2F'></a><a class='shareaholic-googleplusone' data-shr_size='medium' data-shr_count='true' data-shr_href='http%3A%2F%2Fwww.jonzobrist.com%2F2005%2F04%2F25%2Flcod-4-25-05-howto-get-out-of-hung-ssh-sessions%2F' data-shr_title='LCOD+-+4.25.05+-+Howto+get+out+of+hung+SSH+sessions+'></a></div><div style="clear: both; min-height: 1px; height: 3px; width: 100%;"></div><!-- End Shareaholic LikeButtonSetBottom Automatic --><p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.jonzobrist.com/2005/04/25/lcod-4-25-05-howto-get-out-of-hung-ssh-sessions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

