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)

2
  • what OS is running your DHCP server? What DHCP server is being used? Do you puppet or any configuration management system? See - serverfault.com/questions/416779/…
    – Zoredache
    Apr 25, 2013 at 22:59
  • I just have clients. DHCP is managed by hoster. Puppet is too much overhead for my purposes.
    – arney
    Apr 26, 2013 at 9:23

2 Answers 2

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.

3
  • My known_hosts file is /dev/null as Keys change frequently :-(
    – arney
    Apr 25, 2013 at 22:36
  • For auto-completion to be possible there has to be some source of data on your system that bash can use as a source. If you aren't defining your hosts anywhere on the local system you are probably out of luck.
    – Zoredache
    Apr 25, 2013 at 22:57
  • Sure, but host id checking is just too damn naggy. Apart from that, I'd have to copy that file into every other users directory, overriding their's :-(
    – arney
    Apr 26, 2013 at 9:21
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 :-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .