<?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>Linux * Screw &#187; ssh</title>
	<atom:link href="http://www.linuxscrew.com/category/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.linuxscrew.com</link>
	<description></description>
	<lastBuildDate>Fri, 04 Nov 2011 14:19:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=7196</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mount remote filesystem via ssh protocol using sshfs and fuse [Fedora/RedHat/Debian/Ubuntu way]</title>
		<link>http://www.linuxscrew.com/2009/03/10/mount-remote-filesystem-via-ssh-protocol-using-sshfs-and-fuse-fedoraredhatdebianubuntu-way/</link>
		<comments>http://www.linuxscrew.com/2009/03/10/mount-remote-filesystem-via-ssh-protocol-using-sshfs-and-fuse-fedoraredhatdebianubuntu-way/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 17:56:18 +0000</pubDate>
		<dc:creator>artiomix</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[docs]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[howtos]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.linuxscrew.com/?p=674</guid>
		<description><![CDATA[




Imagine the following situation: you have to compile some Linux/Unix application or kernel module that requires kernel source present at your hard drive, say, in /usr/src/kernels/kernel-2.6.21-i386/ or elsewhere. But there is not enough disk space to copy these sources or install kernel-devel or linux-source packages (in Fedora/RedHat or Ubuntu/Debian distros respectively)&#8230; Sounds familiar? Believe me, [...]]]></description>
			<content:encoded><![CDATA[<div class="mceTemp">
<dl id="attachment_673" class="wp-caption alignright" style="width: 138px;">
<dt class="wp-caption-dt"><img class="size-full wp-image-673" title="sshfs" src="http://www.linuxscrew.com/wp-content/uploads/2009/03/sshfs.png" alt="sshfs" width="128" height="128" /></dt>
</dl>
</div>
<p>Imagine the following situation: you have to compile some Linux/Unix application or kernel module that requires kernel source present at your hard drive, say, in /usr/src/kernels/kernel-2.6.21-i386/ or elsewhere. But there is not enough disk space to copy these sources or install kernel-devel or linux-source packages (in Fedora/RedHat or Ubuntu/Debian distros respectively)&#8230; Sounds familiar? Believe me, sometimes it happens <img src='http://www.linuxscrew.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>As a solution you can <strong>mount</strong> the directory of some remote PC that contains needed kernel source. It can be done via several protocols like smb, ftp etc. In this article we will mount remote directory using <strong>ssh protocol</strong> that is one the most popular for remote and secure access to <strong>Linux</strong> boxes over the network.</p>
<p>Below are the steps which should be taken to get the ball rolling. We need two packages: <strong>sshfs</strong> and <strong>fuse-utils</strong>.</p>
<p><img class="size-full wp-image-683 alignright" title="ssh" src="http://www.linuxscrew.com/wp-content/uploads/2009/03/ssh.jpg" alt="ssh" width="264" height="415" /><strong>1.</strong> Install necessary packages:</p>
<p>a. Ubuntu/Debian:</p>
<p><code>sudo aptitude install fuse-utils sshfs</code></p>
<p>b. Fedora/Centos/RedHat:</p>
<p><code>yum install fuse-sshfs fuse fuse-libs</code></p>
<p>c. Other Linux: download and compile sshfs/fuse from <a href="http://fuse.sourceforge.net/sshfs.html">sources</a></p>
<p><strong>2.</strong> Check that kernel module <code>fuse</code> is loaded:</p>
<p><code>lsmod | grep fuse</code></p>
<p>There should be the line containing &#8220;fuse&#8221; in the output (of not try <code>modprobe fuse</code>).</p>
<p><strong>3.</strong> Mount remote filesystem using something like this (two commands):</p>
<p><code>mkdir -p /mnt/sshfs/</code><br />
<code>sshfs remote-user@remote-machine:/some/directory /mnt/sshfs</code></p>
<p>where <em>remote-user</em> is the username allowed to login <em>remote-machine</em> via ssh protocol. It will ask you to type the password so just type it and press return <img src='http://www.linuxscrew.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>4.</strong> That&#8217;s it. Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxscrew.com/2009/03/10/mount-remote-filesystem-via-ssh-protocol-using-sshfs-and-fuse-fedoraredhatdebianubuntu-way/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Secure shell (ssh) session timeout</title>
		<link>http://www.linuxscrew.com/2007/08/27/secure-shell-ssh-session-timeout/</link>
		<comments>http://www.linuxscrew.com/2007/08/27/secure-shell-ssh-session-timeout/#comments</comments>
		<pubDate>Mon, 27 Aug 2007 22:29:13 +0000</pubDate>
		<dc:creator>artiomix</dc:creator>
				<category><![CDATA[centos]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://linuxscrew.com/?p=63</guid>
		<description><![CDATA[I&#8217;ve noticed that when I keep ssh sessions that I opened before untouched for some period of time (like 30 minutes) they become frozen and as a result I have to close ssh terminal and start a new connection. To prevent such situation I found several tips:
1) Start some utility updating the screen before leaving [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve noticed that when I keep ssh sessions that I opened before untouched for some period of time (like 30 minutes) they become frozen and as a result I have to close ssh terminal and start a new connection. To prevent such situation I found several tips:</p>
<p>1) Start some utility updating the screen before leaving ssh session untouched.  I usually use <em>watch -n 1 &#8216;date&#8217;</em><strong><em> </em></strong>that shows current date every second. Other simple way is to send icmp requests to some host, e.g. <em>ping google.com</em>.</p>
<p>2) Increase ssh session idle time by</p>
<p align="left"><em>echo &#8220;7200&#8243; &gt;</em><em> </em><em>/proc/sys/net/ipv4/tcp_keepalive_time </em></p>
<p>I&#8217;ve checked these tips with Fedora Core, CentOS, Debian and Ubuntu but I&#8217;m completely sure that it applicable also for other Linux distributions. First tip (ping) can be used in Unix also.</p>
<p>You may also be interested in:<br />
<a href="http://www.linuxscrew.com/2007/08/15/secure-shell-ssh-connection-without-password/" rel="bookmark" title="Permanent Link to ">Secure shell (ssh) connection without password</a><br />
<a href="http://www.linuxscrew.com/2007/08/06/keep-ssh-session-saved-unix-screen-utility/" rel="bookmark" title="Permanent Link to ">Keep ssh session saved (Unix “screen” utility)</a><br />
<a href="http://www.linuxscrew.com/2007/07/27/moving-linux-to-remote-server-over-ssh-via-third-server/" rel="bookmark" title="Permanent Link to ">Moving Linux to remote server (over ssh via third server)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxscrew.com/2007/08/27/secure-shell-ssh-session-timeout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Secure shell (ssh) connection without password</title>
		<link>http://www.linuxscrew.com/2007/08/15/secure-shell-ssh-connection-without-password/</link>
		<comments>http://www.linuxscrew.com/2007/08/15/secure-shell-ssh-connection-without-password/#comments</comments>
		<pubDate>Wed, 15 Aug 2007 10:16:00 +0000</pubDate>
		<dc:creator>artiomix</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://linuxscrew.com/?p=43</guid>
		<description><![CDATA[Let&#8217;s assume we have two Linux running machines, one of them is &#8216;client&#8217; and other is &#8217;server&#8217;. Task lies in allowing client to access server via ssh securely without a need to type password by hands. It&#8217;s usually useful to perform some operations that are to be done without user intervention (for example copying backup [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s assume we have two Linux running machines, one of them is &#8216;client&#8217; and other is &#8217;server&#8217;. Task lies in allowing client to access server via ssh securely without a need to type password by hands. It&#8217;s usually useful to perform some operations that are to be done without user intervention (for example copying backup data files from client to server through &#8217;scp&#8217;).<span class="fullpost">First of all it&#8217;s necessary to make sure that server we&#8217;re going to access to supports public key authentication. To enable it just add lines &#8216;RSAAuthentication yes&#8217; and &#8216;PubkeyAuthentication yes&#8217; to /etc/ssh/sshd_config at server machine. After that restart ssh daemon (sshd) by executing command &#8216;/etc/init.d/ssh restart&#8217; or &#8217;service ssh restart&#8217; (depends on Linux distribution you use).</span></p>
<p>After it&#8217;s done we should generate public RSA key at client machine and copy it to the list of authorized keys at server.</p>
<p>At client machine execute (leave passphrase empty):</p>
<p><em>ssh-keygen -t rsa</em></p>
<p>this would create public key at /home/your_login/.ssh/id_rsa.pub.</p>
<p>Then copy generated key to server (for example by &#8217;scp&#8217; command):</p>
<p><em>scp /home/your_login/.ssh/id_rsa.pub server_login@server_ip_address:/tmp</em></p>
<p>After client&#8217;s public key is copied to /tmp/id_rsa.pub, login to server and perform the following operation. Add client&#8217;s key to authorized keys list by executing command:</p>
<p><em>mkdir /home/server_login/.ssh</em>  #only if it&#8217;s needed</p>
<p><em>cat /tmp/id_rsa.pub &gt;&gt; /home/server_login/.ssh/authorized_keys</em></p>
<p>When it&#8217;s done try to login to server from client:</p>
<p><em>ssh server_login@server_ip_address</em></p>
<p>Please note it&#8217;s important to copy client&#8217;s public key to user&#8217;s directory you&#8217;re going to login with (in this example it&#8217;s sever_login).</p>
<p>Good luck, mates!</p>
<p><strong>Little update</strong>: it&#8217;s also necessary to uncomment lines in /etc/ssh/sshd_config at server:</p>
<p><em> RSAAuthentication yes<br />
PubkeyAuthentication yes</em></p>
<p>And then restart ssh daemon e.g. by command:</p>
<p><em>/etc/init.d/ssh restart</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxscrew.com/2007/08/15/secure-shell-ssh-connection-without-password/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keep ssh session saved (Unix &#8220;screen&#8221; utility)</title>
		<link>http://www.linuxscrew.com/2007/08/06/keep-ssh-session-saved-unix-screen-utility/</link>
		<comments>http://www.linuxscrew.com/2007/08/06/keep-ssh-session-saved-unix-screen-utility/#comments</comments>
		<pubDate>Mon, 06 Aug 2007 09:19:00 +0000</pubDate>
		<dc:creator>artiomix</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://linuxscrew.com/?p=29</guid>
		<description><![CDATA[Unix screen utility is very useful when you&#8217;re managing remote unix server by means of ssh. This utility allows to save session opened and come back to it after being disconnected&#8230;
Let me describe the certain situation: you&#8217;ve started dump/restore backup operation for full filesystem mirroring to another hard drive remotely by ssh. It works fine [...]]]></description>
			<content:encoded><![CDATA[<p>Unix <a href="http://www.gnu.org/software/screen/">screen</a> utility is very useful when you&#8217;re managing remote unix server by means of ssh. This utility allows to save session opened and come back to it after being disconnected&#8230;<span class="fullpost"><br />
Let me describe the certain situation: you&#8217;ve started dump/restore backup operation for full filesystem mirroring to another hard drive remotely by ssh. It works fine and more than 50% is completed but after power outage or your internet supplier issue you&#8217;ve been disconnected from ssh session. As the result backup/restore operation is stopped and it&#8217;s necessary to start it again.</span></p>
<p>To prevent this just start &#8217;screen&#8217; utility and run needed command after this. In case of disconnection you&#8217;ll need to type &#8217;screen -r&#8217; (-r means restore) and come back to operations you were performing before being disconnected.</p>
<p>This utility is rather powerful and besides allows to create several virtual windows and switch between them by means of hot keys.</p>
<p>Here are some of useful hot keys:</p>
<p><span style="font-weight:bold;">CTRL-a c</span>                        Create a new window<br />
<span style="font-weight:bold;">CTRL-a spacebar</span>                 Go to next window<br />
<span style="font-weight:bold;">CTRL-a backspace or del</span>         Go to previous window<br />
<span style="font-weight:bold;">CTRL-a 2</span>                        Go to window 2<br />
<span style="font-weight:bold;">CTRL-a w</span>                        list windows</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxscrew.com/2007/08/06/keep-ssh-session-saved-unix-screen-utility/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving Linux to remote server (over ssh via third server)</title>
		<link>http://www.linuxscrew.com/2007/07/27/moving-linux-to-remote-server-over-ssh-via-third-server/</link>
		<comments>http://www.linuxscrew.com/2007/07/27/moving-linux-to-remote-server-over-ssh-via-third-server/#comments</comments>
		<pubDate>Fri, 27 Jul 2007 09:35:00 +0000</pubDate>
		<dc:creator>artiomix</dc:creator>
				<category><![CDATA[backup]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://linuxscrew.com/?p=23</guid>
		<description><![CDATA[Source: server running rather obsolete Fedora Core 1 with Apache, sendmail, ftp and other stuff.
Target: any Linux server with at least one hard drive of appropriate disk space installed (in this case target server was running Knoppix).
Third server: any ssh running system.
First of all it&#8217;s necessary to get all servers to be accessible to each [...]]]></description>
			<content:encoded><![CDATA[<p>Source: server running rather obsolete Fedora Core 1 with Apache, sendmail, ftp and other stuff.<br />
Target: any Linux server with at least one hard drive of appropriate disk space installed (in this case target server was running Knoppix).<br />
Third server: any ssh running system.<span class="fullpost"></span></p>
<p>First of all it&#8217;s necessary to get all servers to be accessible to each other via ssh. Read your distribution&#8217;s manual to find out how to achieve it.</p>
<p>There are several possible ways to move Linux to another server by means of using dump/restore utilities over ssh. I&#8217;ve chosen this one: I&#8217;ve saved source server&#8217;s filesystem backup to third server over ssh and then restored this backup to target server (again over ssh).</p>
<p>To do this I&#8217;ve installed dump 0.4b41 onto source server and performed the following commands to save it&#8217;s <strong>/boot</strong> and <strong>/</strong> filesystems backups to third server (both in one line):</p>
<p align="left"><em>dump -0uan -f &#8211; /boot | ssh -c aes256-cbc @ dd of=/home/artemn/backup/dump/dump-boot-l0.bak</em></p>
<p>and</p>
<p align="left"><em>dump -0uan -f &#8211; / | ssh -c aes256-cbc @ dd of=/home/artemn/backup/dump/dump-root-l0.bak</em></p>
<p>It took several hours to transmit 20Gb over Internet in my case. If you&#8217;re performing these operations remotely I recommend to use utility <a href="http://oslb.wordpress.com/2007/08/06/keep-ssh-session-saved-unix-screen-utility/">screen</a> to be sure that transmitting won&#8217;t be stopped when ssh session to source server is closed. To use it just login to source server over ssh and type <em>screen</em> and then <em>dump</em> command with necessary agruments (see below). In case you&#8217;ve been disconnected just ssh again and restore screen session by command <em>screen -r</em>.</p>
<p>You can control above mentioned dump command activity by watching file size of dump-root-l0.bak and dump-boot-l0.bak files at third server.</p>
<p>After dump is finished you can check backup at third server by performing <em>restore -i -f dump-root-l0.bak</em> and walking through directories in backup file (use <em>ls</em> command). For further information read restore manual (interactive restore section): <em>man restore</em>.</p>
<p>Then login to target server and partake hard disk in the same way as it&#8217;s done at source server. In my case I&#8217;ve created three partitions <strong>/dev/sda1</strong> for /boot, <strong>/dev/sda2</strong> for / and <strong>/dev/sda3</strong> for swap. Target server can be running Live CD like Knoppix and have only one hardware drive.</p>
<p>When partitioning is done create filesystems at every partition:</p>
<p><em>mkfs -t ext2 /dev/sda1</em></p>
<p><em>mkfs -t ext2 /dev/sda2</em></p>
<p><em>mkswap /dev/sda3</em></p>
<p>Then set volume labels to just created filesystems by commands:</p>
<p><em>tune2fs -L &#8220;/boot&#8221; /dev/sda1</em></p>
<p>and</p>
<p><em>tune2fs -L &#8220;/&#8221; /dev/sda2</em></p>
<p>Labels should be the same as at source server (you can see them by executing <em>tune2fs -l /dev/sda1</em> and <em>tune2fs -l /dev/sda2</em> at source server). Sometimes it&#8217;s also necessary to set up volume label for swap filesystem.</p>
<p>When it&#8217;s done mount created filesystems by commands:</p>
<p><em>mount /dev/sda1 /mnt/sda1</em></p>
<p>and</p>
<p><em>mount /dev/sda2 /mnt/sda2</em></p>
<p>(be sure that /mnt/sda1 and /mnt/sda2 are created).</p>
<p>To restore filesystem from backed up copy, &#8216;<em>cd</em>&#8216; to destination directory and restore data by commands:</p>
<p><em>cd /mnt/sda1</em></p>
<p>and</p>
<p align="left"><em>ssh @ &#8220;cat /home/artemn/backup/dump/dump-boot-l0.bak&#8221; | restore -r -f -</em></p>
<p>then</p>
<p><em>cd /mnt/sda2</em></p>
<p>and</p>
<p align="left"><em>ssh @ &#8220;cat /home/artemn/backup/dump/dump-root-l0.bak&#8221; | restore -r -f -</em></p>
<p>In case of success <strong>/mnt/sda1</strong> and <strong>/mnt/sda2</strong> will contain the same files at /boot and / directories at source server.</p>
<p>When filesystems restoration is done we should install boot loader onto hard drive of target sever: start grub console by typing <em>grub</em> and then type <em>root (hd0, 0)</em>, then <em>setup (hd0)</em>. After this boot loader will be installed and target server can be booted from hard disk.</p>
<p>Note: be sure that dump and restore commands run at source and target servers are of same versions as it causes problems sometimes. I&#8217;ve used 0.4b41 at Fedora Core 1 (source) and Knoppix (target server).</p>
<p>Another note: I&#8217;ve spent a day to solve the problem with kernel panic when booting into target server&#8217;s hard disk. The problem was in volume labels. So don&#8217;t forget to set them.</p>
<p>Hope it helps somebody! Good luck, mates!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxscrew.com/2007/07/27/moving-linux-to-remote-server-over-ssh-via-third-server/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

