Bash Autocompletion on Breezy

Bash autocompletion is very handy especially if you are using ssh to login to the same hosts over and over again.

Unfortunately breezy includes a minor change to the ssh client configuration that will cause this to break.

If you look in a standard known_hosts file in your ssh directory you should see a human readable part including the hostname and IP followed by the usual mumbo jumbo.
In the breezy standard setup the contents are all hashed, so you can’t make out any of the contents.
The breezy ssh client config located in:
/etc/ssh/ssh_config
Includes the following line at the bottom of the file:


HashKnownHosts yes

which means that by default autocompletion will fail miserably as the hostname / IP will not be readable, as it is stored in a hash.
Simple solution.

Change the line to read:

HashKnownHosts no

Remove the existing ssh history:


cd .ssh
rm known_hosts

Make sure that autocomplete is on in your profile by checking that the following section in your .bashrc file is uncommented:
 if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi

And your autocompletion should start working again.
There’s probably a very good reason why the package maintainers changed the default, but it took me some time to work out why my autocompletion wasn’t working
*sigh*

By Michele Neylon

Michele is founder and CEO of Irish hosting provider and domain name registrar Blacknight.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Exit mobile version