<?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>Pario TechnoBlob &#187; ssh</title>
	<atom:link href="http://pario.no/tag/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>http://pario.no</link>
	<description>A cronological documentation test project, nothing serious, really!</description>
	<lastBuildDate>Thu, 02 Feb 2012 13:17:58 +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>Using Lsyncd to perform &#8220;live&#8221; syncronization of a local directory to a remote directory</title>
		<link>http://pario.no/2012/01/13/using-lsyncd-to-perform-live-syncronization-of-a-local-directory-to-a-remote-directory/</link>
		<comments>http://pario.no/2012/01/13/using-lsyncd-to-perform-live-syncronization-of-a-local-directory-to-a-remote-directory/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 18:14:20 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[lsyncd]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ssh-keygen]]></category>

		<guid isPermaLink="false">http://pario.no/?p=1672</guid>
		<description><![CDATA[This post is a short HOWTO and describes how you can install and run lsyncd to perform a rsync syncronization from local to a remote server using SSH. Lsyncd is a daemon to continuously synchronize directory trees and relies on inotify. If you need real live syncronization DRBD might be a better alternative since it [...]]]></description>
			<content:encoded><![CDATA[<p>This post is a short HOWTO and describes how you can install and run <a href="http://code.google.com/p/lsyncd/">lsyncd</a> to perform a rsync syncronization from local to a remote server using SSH.<br />
Lsyncd is a daemon to continuously synchronize directory trees and relies on inotify. If you need real live syncronization DRBD might be a better alternative since it is a block level syncronization. </p>
<p><strong>Installing Lsyncd 2.0 from source on CentOS 6</strong><br />
Lsyncd is not included as a package in CentOS 6, so you need to download the source file from <a href="http://code.google.com/p/lsyncd/downloads/list">http://code.google.com/p/lsyncd/downloads/list</a>.<br />
You should have rsync, GCC and lua-devel installed on your system before you continue installing Lsyncd.</p>
<pre>
# yum install rsync lua-devel</pre>
<p>Unpack the lsyncd source file and run the following commands from the unpacked file</p>
<pre>
# configure
# make
# make install</pre>
<p>make install copies the compiled files and install them to the right directories in your system.</p>
<p>I need to configure a non password SSH communication between the two servers with a shared SSH key.<br />
On the source server run the following command to generate a SSH key, if you have not done this already.<br />
Remember to do this as the user you are going to perform the sync with.</p>
<pre>
# ssh-keygen</pre>
<p>Secure copy the generated SSH key from the source server to your target server</p>
<pre>
# scp ~/.ssh/id_rsa.pub root@remoteserver:/tmp</pre>
<p>On the target server you need to add the copied SSH key to your existing authorized keys file.<br />
Also remember to do this with the user you are going to connect with from the source server.</p>
<pre>
# cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys</pre>
<p>If you do not have this file, just create it using the touch command described below</p>
<pre>
# touch ~/.ssh/authorized_keys</pre>
<p>Test if you can ssh without a password from your source server to the target server.</p>
<p>I have made a config file, <strong>/root/scripts/lsyncd.conf</strong> that tells Lsyncd where to put the log- and statusfile. That it should be running as a daemon in the background, and a sync should occur after 900 seconds (15 minutes) if there have not been any filesystem changes and there should not be more than 6 parallell Lsyncd processes.</p>
<pre>
settings = {
   logfile      = "/tmp/lsyncd.log",
   statusFile   = "/tmp/lsyncd.status",
   nodaemon     = false,
   maxDelays    = 900,
   maxProcesses = 6,
}

sync{default.rsyncssh, source="/path/on/source/", host="hostnam.target.server.tld", targetdir="/path/on/target/"}</pre>
<p>To start lsyncd you run the command</p>
<pre>
# lsyncd /root/scripts/lsyncd.conf</pre>
<p>You should now see a Lsyncd process running as a daemon on your system. It performs a sync when you start and then waits for any filesystem changes or sync after 900 seconds.</p>
<p>If you would like Lsyncd to start at boot, just add the following line to the bottom of file <strong>/etc/rc.local</strong></p>
<pre>
lsyncd /root/scripts/lsyncd.conf</pre>
<p>You do now have a working secure rsync syncronization between two servers.</p>
<p><strong>What directories you are syncing</strong></p>
<pre>
# tail -f /tmp/lsyncd.status</pre>
<p><strong>What is happening now</strong></p>
<pre>
# tail -f /tmp/lsyncd.log</pre>
<script type="text/javascript">var wordpress_toolbar_urls = ["http:\/\/code.google.com\/p\/lsyncd\/","http:\/\/code.google.com\/p\/lsyncd\/downloads\/list"];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMTIvMDEvMTMvdXNpbmctbHN5bmNkLXRvLXBlcmZvcm0tbGl2ZS1zeW5jcm9uaXphdGlvbi1vZi1hLWxvY2FsLWRpcmVjdG9yeS10by1hLXJlbW90ZS1kaXJlY3RvcnkvPHdwdGI%2BVXNpbmcgTHN5bmNkIHRvIHBlcmZvcm0gJiM4MjIwO2xpdmUmIzgyMjE7IHN5bmNyb25pemF0aW9uIG9mIGEgbG9jYWwgZGlyZWN0b3J5IHRvIGEgcmVtb3RlIGRpcmVjdG9yeTx3cHRiPmh0dHA6Ly9wYXJpby5ubzx3cHRiPlBhcmlvIFRlY2hub0Jsb2I%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2012/01/13/using-lsyncd-to-perform-live-syncronization-of-a-local-directory-to-a-remote-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compare a remote file with a local file using ssh and diff</title>
		<link>http://pario.no/2010/09/09/compare-a-remote-file-with-a-local-file-using-ssh-and-diff/</link>
		<comments>http://pario.no/2010/09/09/compare-a-remote-file-with-a-local-file-using-ssh-and-diff/#comments</comments>
		<pubDate>Thu, 09 Sep 2010 19:52:22 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[diff]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://pario.no/?p=1394</guid>
		<description><![CDATA[# ssh user@example.com cat /path/to/remotefile &#124; diff /path/to/localfile -]]></description>
			<content:encoded><![CDATA[<pre>
# ssh user@example.com cat /path/to/remotefile | diff /path/to/localfile -</pre>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMTAvMDkvMDkvY29tcGFyZS1hLXJlbW90ZS1maWxlLXdpdGgtYS1sb2NhbC1maWxlLXVzaW5nLXNzaC1hbmQtZGlmZi88d3B0Yj5Db21wYXJlIGEgcmVtb3RlIGZpbGUgd2l0aCBhIGxvY2FsIGZpbGUgdXNpbmcgc3NoIGFuZCBkaWZmPHdwdGI%2BaHR0cDovL3BhcmlvLm5vPHdwdGI%2BUGFyaW8gVGVjaG5vQmxvYg%3D%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2010/09/09/compare-a-remote-file-with-a-local-file-using-ssh-and-diff/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Secure browsing with Firefox and SOCKS v5</title>
		<link>http://pario.no/2008/09/04/secure-browsing-with-firefox-and-socks-v5/</link>
		<comments>http://pario.no/2008/09/04/secure-browsing-with-firefox-and-socks-v5/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 22:43:22 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[firefox3]]></category>
		<category><![CDATA[putty]]></category>
		<category><![CDATA[SOCKS5]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://pario.no/?p=571</guid>
		<description><![CDATA[This post describes how you can setup secure web browsing using Firefox3 and by setting up a SSH tunnel from your PC/host to a remote PC/host. Your PC will then act as a local SOCKS proxy and all applications that supports SOCKS5 interface to this port. This is a handy solution if you are on [...]]]></description>
			<content:encoded><![CDATA[<p>This post describes how you can setup secure web browsing using Firefox3 and by setting up a SSH tunnel from your PC/host to a remote PC/host. Your PC will then act as a local SOCKS proxy and all applications that supports SOCKS5 interface to this port. This is a handy solution if you are on a untrusted net like a wireless connection. The solution can also be used in Thunderbird if you would like.<br />
<b>Note</b><br />
It is important to note that it&#8217;s only the connection between your host and the remote host that is secure. It is also important to note that Firefox will do DNS queries to the untrusted netwoork. This can be fixed by opening the <b>about:config</b> page and change <b>network.proxy.socks_remote_dns</b> to true. </p>
<p>Start a SSH connection to a host that you want to proxy through. Use the -D option to specify a SOCKS5 port on your localhost. The port doesn&#8217;t really matter. Just make sure you use the same port in your SOCKS client application.</p>
<pre>
# ssh -D 3333 username@example.com</pre>
<p>In Firefox select &#8220;Tools | Options&#8230; | Advanced | Network |Settings&#8230; button&#8221;.<br />
<img src="http://pario.no/wp-content/uploads/2008/09/firefox3_socks5_1.jpg" alt="" title="firefox3_socks5_1" width="500" height="483" class="alignnone size-full wp-image-574" /><br />
Then select &#8220;Manual proxy configuration&#8221;. All you need to fill out is &#8220;SOCKS Host: Localhost&#8221;, &#8220;Port: 3333&#8243;, then select &#8220;SOCKS v5&#8243;.<br />
<img src="http://pario.no/wp-content/uploads/2008/09/firefox3_socks5_2.jpg" alt="" title="firefox3_socks5_2" width="461" height="469" class="alignnone size-full wp-image-575" /></p>
<p>Type in &#8220;localhost&#8221; in the SOCKS host field and press the OK button.</p>
<p>You are now ready to surf using Firefox3 and SOCKS5 througt a SSH tunnel.</p>
<h2>Configure a secure tunnel using Putty</h2>
<p>You can also use Putty if you are a Windows user. The configuration is then as follows:<br />
<img src="http://pario.no/wp-content/uploads/2008/09/firefox3_socks5_3.jpg" alt="" title="firefox3_socks5_3" width="466" height="446" class="alignnone size-full wp-image-586" /></p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDgvMDkvMDQvc2VjdXJlLWJyb3dzaW5nLXdpdGgtZmlyZWZveC1hbmQtc29ja3MtdjUvPHdwdGI%2BU2VjdXJlIGJyb3dzaW5nIHdpdGggRmlyZWZveCBhbmQgU09DS1MgdjU8d3B0Yj5odHRwOi8vcGFyaW8ubm88d3B0Yj5QYXJpbyBUZWNobm9CbG9i";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2008/09/04/secure-browsing-with-firefox-and-socks-v5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix slow SSH login</title>
		<link>http://pario.no/2008/05/29/fix-slow-ssh-login-in-ubuntu-804-hardy-heron/</link>
		<comments>http://pario.no/2008/05/29/fix-slow-ssh-login-in-ubuntu-804-hardy-heron/#comments</comments>
		<pubDate>Wed, 28 May 2008 23:49:51 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://pario.no/?p=458</guid>
		<description><![CDATA[Add the following line if your SSH login takes a long time on your SSH server. File /etc/ssh/sshd_config: UseDNS no Restart the SSH daemon to activate this change.]]></description>
			<content:encoded><![CDATA[<p>Add the following line if your SSH login takes a long time on your SSH server.</p>
<p>File <strong>/etc/ssh/sshd_config</strong>:</p>
<pre>
UseDNS no</pre>
<p>Restart the SSH daemon to activate this change.</p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDgvMDUvMjkvZml4LXNsb3ctc3NoLWxvZ2luLWluLXVidW50dS04MDQtaGFyZHktaGVyb24vPHdwdGI%2BRml4IHNsb3cgU1NIIGxvZ2luPHdwdGI%2BaHR0cDovL3BhcmlvLm5vPHdwdGI%2BUGFyaW8gVGVjaG5vQmxvYg%3D%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2008/05/29/fix-slow-ssh-login-in-ubuntu-804-hardy-heron/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mounting remote filesystems using SSH and Debian</title>
		<link>http://pario.no/2008/02/20/mounting-remote-filesystems-using-ssh-and-debian/</link>
		<comments>http://pario.no/2008/02/20/mounting-remote-filesystems-using-ssh-and-debian/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 20:50:40 +0000</pubDate>
		<dc:creator>Hans-Henry Jakobsen</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Etch]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://pario.no/2008/02/19/mounting-remote-filesystems-using-ssh-and-debian/</guid>
		<description><![CDATA[This post describes how to mount a remote filesystem through SSH using the shfs kernel module on a Debian Etch server. By doing this I can access the remote filesystem as if it was a local filesystem and also use my local tools and software. This is a short description of how I made a [...]]]></description>
			<content:encoded><![CDATA[<p>This post describes how to mount a remote filesystem through SSH using the shfs kernel module on a Debian Etch server. By doing this I can access the remote filesystem as if it was a local filesystem and also use my local tools and software.<br />
This is a short description of how I made a remote filesystem accessible on my private server.</p>
<p>Download the needed software</p>
<pre>
# apt-get install shfs-source shfs-utils module-assistant</pre>
<p>This step might not be needed on your system, but I didn&#8217;t have the needed software to build the kernel module</p>
<pre>
# module-assistant prepare</pre>
<p>Use the module assistant to build the kernel module to match your local system (I use a 2.6 kernel but this whould work on a 2.4 kernel also)</p>
<pre>
module-assistant build shfs</pre>
<p>Now you can install it</p>
<pre>
# module-assistant install shfs
Selecting previously deselected package shfs-module-2.6.18-5-686.
(Reading database ... 78212 files and directories currently installed.)
Unpacking shfs-module-2.6.18-5-686 (from .../shfs-module-2.6.18-5-686_0.35-6.2+2.6.18.dfsg.1-17_i386.deb) ...
Setting up shfs-module-2.6.18-5-686 (0.35-6.2+2.6.18.dfsg.1-17) ...</pre>
<p>You might see some error messages but those are mostly harmless :) and can be ignored.<br />
Now we can try to mount the remote filesystem</p>
<pre>
# mkdir /export/remotefs
# shfsmount user@remotesystem.com /export/remotefs
Password:</pre>
<p>The remote filesystem should now be available after typing your password.</p>
<pre>
# cd /export/remotefs
# ls</pre>
<p>You will now see all your files in the remote filesystem as if they were on your local machine.<br />
To unmount your filesystem</p>
<pre>
# cd /
# umount /export/remotefs</pre>
<p>This post could have been extended to use passwordless</p>
<script type="text/javascript">var wordpress_toolbar_urls = [];var wordpress_toolbar_url = "http://pario.no/wp-content/plugins/wordpress-toolbar/toolbar.php";var wordpress_toolbar_oinw = "n";var wordpress_toolbar_hash = "aHR0cDovL3BhcmlvLm5vLzIwMDgvMDIvMjAvbW91bnRpbmctcmVtb3RlLWZpbGVzeXN0ZW1zLXVzaW5nLXNzaC1hbmQtZGViaWFuLzx3cHRiPk1vdW50aW5nIHJlbW90ZSBmaWxlc3lzdGVtcyB1c2luZyBTU0ggYW5kIERlYmlhbjx3cHRiPmh0dHA6Ly9wYXJpby5ubzx3cHRiPlBhcmlvIFRlY2hub0Jsb2I%3D";</script>]]></content:encoded>
			<wfw:commentRss>http://pario.no/2008/02/20/mounting-remote-filesystems-using-ssh-and-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

