Bash – getting a random IP in bash-completion when I try a network command

bashnetworkingssh

One of the PC's on my home net has the hostname '3770k', because that's the model of its CPU.

I usually type 'ssh 3' and hit tab to autocomplete the connection.

I just realised I now have two entries starting with a 3: my regular 3770k one and also 35.156.197.162.

It appears when I try ssh, scp and rsync. It traces to Ann Arbor, Michican. I'm in the UK and have never knowingly connected to a PC in Michigan.

Any idea what I've done? Is there a config file I might have accidentaly appended this address to? I've looked in ~/.ssh/config and it isn't there. I haven't accidentally created a file named after the IP. If I try to ping this mystery address I get no reply.

There's a colon after it if I autocomplete it with ssh, so my PC seems to think it's a network location.

Best Answer

It appears as if Bash is using the known_hosts file in $HOME/.ssh for its auto-complete under some circumstances.

If you have connected using SSH (i.e. using ssh, rsync, git with SSH, or any other utility that uses SSH) to this host, which is an Amazon cloud host, then it's reasonable that the IP address is written to this file, and picked up by the bash auto-completion sub-system.

If the IP address is in there, you should also be able to figure out the human readable hostname that you used when connecting to the host (it will have the same SSH fingerprint in the file).

Related Question