3

I know I could get a list of hostnames into bash tab-completion of ssh by adding them to /etc/hosts, but since they are on DHCP, it's kinda bad practice.

Does anyone know another DHCP-aware way, that doesn't force me to interfere with Ubuntu too much?

(Global solution preferred)

arney
  • 153

2 Answers2

3

The simplest way is to simply disable the HashKnownHosts option globally or in your personal .ssh/config file. If you disable that, and also have the bash-completion package installed, then any host you connect to will be available for auto-completion after you have connected the first time.

You could use ssh-keyscan to build up a nice big list to pre-populate your known_hosts file.

Zoredache
  • 133,737
1

Came up with a good one myself:

sudo sh -c "echo 'Host client1.hoster.org' >> /etc/ssh/ssh_config"

works immediately and for every user :-)

arney
  • 153