Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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)

share|improve this question
    
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 '13 at 22:59
    
I just have clients. DHCP is managed by hoster. Puppet is too much overhead for my purposes. –  arney Apr 26 '13 at 9:23

2 Answers 2

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.

share|improve this answer
    
My known_hosts file is /dev/null as Keys change frequently :-( –  arney Apr 25 '13 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 '13 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 '13 at 9:21
up vote 1 down vote accepted

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 :-)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.