<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Traincoding: SSH aliases</title>
	<atom:link href="http://blogs.ubuntu-nl.org/dennis/2008/07/29/traincoding-ssh-aliases/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.ubuntu-nl.org/dennis/2008/07/29/traincoding-ssh-aliases/</link>
	<description>Bastard Operator For Life</description>
	<pubDate>Mon, 22 Mar 2010 11:10:38 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Dennis Kaarsemaker</title>
		<link>http://blogs.ubuntu-nl.org/dennis/2008/07/29/traincoding-ssh-aliases/#comment-95467</link>
		<dc:creator>Dennis Kaarsemaker</dc:creator>
		<pubDate>Sat, 02 Aug 2008 20:21:29 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.ubuntu-nl.org/dennis/?p=249#comment-95467</guid>
		<description>The bash-completion package has much better completion for ssh/scp etc, including remote filename completion for scp and rsync :)</description>
		<content:encoded><![CDATA[<p>The bash-completion package has much better completion for ssh/scp etc, including remote filename completion for scp and rsync :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Malcolm Parsons</title>
		<link>http://blogs.ubuntu-nl.org/dennis/2008/07/29/traincoding-ssh-aliases/#comment-95011</link>
		<dc:creator>Malcolm Parsons</dc:creator>
		<pubDate>Thu, 31 Jul 2008 16:15:52 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.ubuntu-nl.org/dennis/?p=249#comment-95011</guid>
		<description>bash can do hostname completion.

$ export HOSTFILE=~/hostnames
$ cat $HOSTFILE
example.com
me.homelinux.org
ftp.isp.com
$ ssh 
example.com       ftp.isp.com       me.homelinux.org
$ ssh e
$ ssh example.com</description>
		<content:encoded><![CDATA[<p>bash can do hostname completion.</p>
<p>$ export HOSTFILE=~/hostnames<br />
$ cat $HOSTFILE<br />
example.com<br />
me.homelinux.org<br />
<a href="http://ftp.isp.com" rel="nofollow">http://ftp.isp.com</a><br />
$ ssh<br />
example.com       <a href="http://ftp.isp.com" rel="nofollow">http://ftp.isp.com</a>       me.homelinux.org<br />
$ ssh e<br />
$ ssh example.com</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ephemient</title>
		<link>http://blogs.ubuntu-nl.org/dennis/2008/07/29/traincoding-ssh-aliases/#comment-94946</link>
		<dc:creator>ephemient</dc:creator>
		<pubDate>Wed, 30 Jul 2008 15:29:44 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.ubuntu-nl.org/dennis/?p=249#comment-94946</guid>
		<description>Hmm, my .ssh/config has a stanza for every host I've ever accessed more than once, I don't see why it's unmaintainable.

But the lack of the ability to do something like
Host foo-%1
HostName foo-%1.bar.baz.bam
does make me sad.</description>
		<content:encoded><![CDATA[<p>Hmm, my .ssh/config has a stanza for every host I&#8217;ve ever accessed more than once, I don&#8217;t see why it&#8217;s unmaintainable.</p>
<p>But the lack of the ability to do something like<br />
Host foo-%1<br />
HostName foo-%1.bar.baz.bam<br />
does make me sad.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dennis Kaarsemaker</title>
		<link>http://blogs.ubuntu-nl.org/dennis/2008/07/29/traincoding-ssh-aliases/#comment-94916</link>
		<dc:creator>Dennis Kaarsemaker</dc:creator>
		<pubDate>Wed, 30 Jul 2008 07:23:19 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.ubuntu-nl.org/dennis/?p=249#comment-94916</guid>
		<description>ephemient: That's unmaintainable for hundreds of hosts :) My .ssh/config is fairly short, uses lots of wildcards and ProxyCommands.</description>
		<content:encoded><![CDATA[<p>ephemient: That&#8217;s unmaintainable for hundreds of hosts :) My .ssh/config is fairly short, uses lots of wildcards and ProxyCommands.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sam</title>
		<link>http://blogs.ubuntu-nl.org/dennis/2008/07/29/traincoding-ssh-aliases/#comment-94888</link>
		<dc:creator>Sam</dc:creator>
		<pubDate>Wed, 30 Jul 2008 02:42:25 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.ubuntu-nl.org/dennis/?p=249#comment-94888</guid>
		<description>Great script! I made some mods that you might like (and I hope pre works!):


#!/bin/bash
shopt -s extglob
isint(){
    case $1 in
        ?([-+])+([0-9]) )
            return 0;;
        *) return 1;;
            esac
}

if [[ -d ~/.ssh ]]; then

    # Touch files we expect to exist
    if [[ ! -e ~/.ssh/config ]]; then touch ~/.ssh/config; fi
    if [[ ! -e ~/.ssh/known_hosts ]]; then touch ~/.ssh/known_hosts; fi

    # Parse ~/.ssh/known_hosts and ~/.ssh/config to find hosts
    for x in `sed -e 's/[, ].*//' ~/.ssh/known_hosts; awk '/^Host [^*?]+$/{print $2}' ~/.ssh/config`; do

        # Don’t override commands
        type "${x}" &#62; /dev/null 2&#62;&#38;1 &#38;&#38; continue

        # Remove the domainname
        y=${x%%.*}
        # you don't want IP addresses for aliases, trust me.
        isint $y &#38;&#38; continue

        # If it's a short-name, move on
        #z=${x##*.}
        #[[  "${z}" == 'edu' &#124;&#124;  "${z}" == 'com' &#124;&#124; "${z}" == 'net' ]] &#124;&#124; continue
        # So the above is commented out because you'd be surprised at how much you rely on your search path
        # You should pipe the output of this script to sort and your fqdn's will override your shorts.
        echo alias "${x}"=”ssh $x”

        if [[ "$y" != "$x" ]]; then
            if ! type $y &#62; /dev/null 2&#62;&#38;1; then
            echo     alias $y=”ssh $x”
            fi
        fi
    done
fi
</description>
		<content:encoded><![CDATA[<p>Great script! I made some mods that you might like (and I hope pre works!):</p>
<p>#!/bin/bash<br />
shopt -s extglob<br />
isint(){<br />
    case $1 in<br />
        ?([-+])+([0-9]) )<br />
            return 0;;<br />
        *) return 1;;<br />
            esac<br />
}</p>
<p>if [[ -d ~/.ssh ]]; then</p>
<p>    # Touch files we expect to exist<br />
    if [[ ! -e ~/.ssh/config ]]; then touch ~/.ssh/config; fi<br />
    if [[ ! -e ~/.ssh/known_hosts ]]; then touch ~/.ssh/known_hosts; fi</p>
<p>    # Parse ~/.ssh/known_hosts and ~/.ssh/config to find hosts<br />
    for x in `sed -e &#8217;s/[, ].*//&#8217; ~/.ssh/known_hosts; awk &#8216;/^Host [^*?]+$/{print $2}&#8217; ~/.ssh/config`; do</p>
<p>        # Don’t override commands<br />
        type &#8220;${x}&#8221; &gt; /dev/null 2&gt;&amp;1 &amp;&amp; continue</p>
<p>        # Remove the domainname<br />
        y=${x%%.*}<br />
        # you don&#8217;t want IP addresses for aliases, trust me.<br />
        isint $y &amp;&amp; continue</p>
<p>        # If it&#8217;s a short-name, move on<br />
        #z=${x##*.}<br />
        #[[  "${z}" == 'edu' ||  "${z}" == 'com' || "${z}" == 'net' ]] || continue<br />
        # So the above is commented out because you&#8217;d be surprised at how much you rely on your search path<br />
        # You should pipe the output of this script to sort and your fqdn&#8217;s will override your shorts.<br />
        echo alias &#8220;${x}&#8221;=”ssh $x”</p>
<p>        if [[ "$y" != "$x" ]]; then<br />
            if ! type $y &gt; /dev/null 2&gt;&amp;1; then<br />
            echo     alias $y=”ssh $x”<br />
            fi<br />
        fi<br />
    done<br />
fi</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ephemient</title>
		<link>http://blogs.ubuntu-nl.org/dennis/2008/07/29/traincoding-ssh-aliases/#comment-94873</link>
		<dc:creator>ephemient</dc:creator>
		<pubDate>Wed, 30 Jul 2008 01:12:15 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.ubuntu-nl.org/dennis/?p=249#comment-94873</guid>
		<description>See man 5 ssh_config for a nicer solution:

$ cat ~/.ssh/config
Host shortname
HostName some.really.long.hostname
User username_that_i_never_remember
$ ssh shortname  # == ssh username_that_i_never_remember@some.really.long.hostname

Works regardless of your shell, and scp/sftp recognize the shortnames as well.</description>
		<content:encoded><![CDATA[<p>See man 5 ssh_config for a nicer solution:</p>
<p>$ cat ~/.ssh/config<br />
Host shortname<br />
HostName some.really.long.hostname<br />
User username_that_i_never_remember<br />
$ ssh shortname  # == ssh <a href="mailto:username_that_i_never_remember@some.really.long.hostname">username_that_i_never_remember@some.really.long.hostname</a></p>
<p>Works regardless of your shell, and scp/sftp recognize the shortnames as well.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
