<?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>Blog.ubrious &#187; nano</title>
	<atom:link href="http://blog.ubrio.us/tag/nano/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ubrio.us</link>
	<description>An Ordinary Web Developer's Blog</description>
	<lastBuildDate>Thu, 19 Jan 2012 00:44:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>OSX Terminal Niceties for Remote Servers</title>
		<link>http://blog.ubrio.us/nix/osx-terminal-niceties-for-remote-servers/</link>
		<comments>http://blog.ubrio.us/nix/osx-terminal-niceties-for-remote-servers/#comments</comments>
		<pubDate>Wed, 14 Nov 2007 20:46:56 +0000</pubDate>
		<dc:creator>Rob Hurring</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Nix]]></category>
		<category><![CDATA[bashrc]]></category>
		<category><![CDATA[nano]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://blog.ubrio.us/osx/osx-terminal-niceties-for-remote-servers/</guid>
		<description><![CDATA[I have absolutely no idea what to title this as &#8212; and frankly, its more for me than anyone else. I need a place to store this before I forget and go racking my brain 2 years from now on how to do this.
If you think you&#8217;re interested &#8212; this post is about the following:

How [...]]]></description>
			<content:encoded><![CDATA[<p>I have absolutely no idea what to title this as &#8212; and frankly, its more for me than anyone else. I need a place to store this before I forget and go racking my brain 2 years from now on how to do this.</p>
<h5>If you think you&#8217;re interested &#8212; this post is about the following:</h5>
<ol>
<li>How to get your current user/directory in the title of terminal (iTerm.app for this post &#8212; same applies for Terminal.app though)</li>
<li>How to make the backspace/delete keys work properly in nano/pico on local and remote servers</li>
<li>Update your current user/path in the title when you SSH into a remote machine</li>
<li>And how to setup password-less SSH, just because its on topic</li>
</ol>
<h3>.bashrc modifications</h3>
<p>Making Terminal.app&#8217;s title update to the current user &#038; path for both local and remote servers while letting the backspace and delete key work properly &#8212; all in one solution! <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class='tip'>Get yourself a nifty shell prompt over here -><a href="http://blog.ubrio.us/osx/best-bash-prompt/">Bash Prompt Madness</a></div>
<h5>Add the following lines to both your local &#038; remote .bashrc</h5>
<pre class="brush: ruby;">
# this is what updates your Terminal's title -- you can of course modify this
# but im not explaining how -- google it
export PROMPT_COMMAND='echo -ne &quot;\\033]0;${USER}:${PWD}\\007&quot;'

# this will make OSXs backspace &amp; delete keys work properly
# in nano &amp; pico
export TERM=xterm
stty erase ^H

# fancy prompt you say?
# again -- google for more info on this
export PS1=&quot;\\[\\033[0;34m\\][\\!]\[\\033[0;32m\\][\\u.\\h: \\w]\[\\033[0;32m\\]\\$\\[\\033[0m\\] &quot;

#gives you something like:
# [0][rob.hades: ~]$ echo 'hello world!'
</pre>
<h5>Now lets bind our servers for SSH so we don&#8217;t need passwords</h5>
<p>Passwords are annoying &#8212; especially when you are using <a href="http://en.wikipedia.org/wiki/Secure_copy" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Secure_copy?referer=');">scp</a> and <a href="http://en.wikipedia.org/wiki/Rsync" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Rsync?referer=');">rsync</a> a lot.</p>
<p>Here is a very simple way to drop those passwords and have SSH do all the work.</p>
<h6>In your terminal app (Locally)</h6>
<p>Make your .ssh directory<br />
<code><span>$></span>mkdir -p ~/.ssh &#038;&#038; cd ~/.ssh</code></p>
<p>Generate yourself some keys<br />
<code><span>~/.ssh $></span>ssh-keygen -t dsa -f ~/.ssh/id_dsa</code></p>
<p>Copy your public key to your remote server (Make sure the remote server has a ~/.ssh directory as well!)<br />
<code><span>~/.ssh $></span>scp id_dsa.pub {user}@{remoteserver}:.ssh</code></p>
<h6>In the remote computer</h6>
<p>Add that public key to your authorized_keys file for SSH<br />
<code><span>$></span>cd .ssh &#038;&#038; cat id_dsa.pub >> authorized_keys2</code></p>
<p>Cleanup those files and make sure the authorized_keys file is set to the right perms.<br />
<code><span>~/.ssh $></span>chmod 640 authorized_keys2 &#038;&#038; rm id_dsa.pub</code></p>
<p>That should make your life a bit more convenient <img src='http://blog.ubrio.us/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ubrio.us/nix/osx-terminal-niceties-for-remote-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

