bash completion does not work for ssh

Bug #42382 reported by driedlinger
22
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bash (Ubuntu)
Invalid
Low
Unassigned

Bug Description

bash completion does not work for ssh.
I have verified that the bash completion portion in the /ect/profiile, /etc/bash_completion and my .bash_profile / .bashrc do not have any commented parts that would inhibit it from working. The bash completion works for other commands.

After looking at .ssh/know_hosts file....that may be the issue.
It does not look like a normal knowhost file
Here is a snippet.
|1|AYGo+egg1pJpsfvebubolAnKnkY=|9gSlcIoCPlH17m8gjAH2G/3f+BM= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAu9qQ1aV3NzGRzNwE0J8fL5s8rTXnkhVply2yFHKO87M/HJsIJSy/oyEvZU0T0lRIZF/MG0HDIIbtf30O5xOKlxvnLs2KMzVqc7nJc9a+iyak0G1cHLkO8ey2fKuGO7jBq0h6dgz07B188If7L7hwS45OTA0geWh8W2gRgn712/c=

Here is the actual ssh tab complete invocation out of bash..
 ssh |1|

It does appear that it is working as it parsing the know_hosts file and getting "|1|" but it is actually meaningless as it should be a host name. Maybe a comand sub issue with ssh? Maybe this should be routed to the ssh folks ???

Note: the original reporter indicated the bug was in package 'bash-completion'; however, that package was not published in Ubuntu.

Revision history for this message
driedlinger (darinr) wrote :

My bad this is coming out of Ubuntu Dapper Beta 6.06

Revision history for this message
Gary Coady (garycoady) wrote :

As a security feature, ssh defaults to hashing the host details when saving into the known_hosts file. This is because of possible issues like worms using the names to propagate themselves across networks.

You can disable this feature by either commenting out the 'HashKnownHosts' line in /etc/ssh/ssh_config or by putting the line
HashKnownHosts no
into ~/.ssh/config

Since bash completion should ignore hashed lines, I'll reassign this bug to bash to fix that.

Revision history for this message
Gary Coady (garycoady) wrote :

bash completion should ignore hashed hosts in ~/.ssh/known_hosts.

Revision history for this message
Lionel Porcheron (lionel.porcheron) wrote :

As Gary said, it is a choice that has been made on breezy to hash ~/.ssh/known_hosts to prevent worms usage. As a result, bash completion can not use it.

If you want to get completion, just do what Gary described in his comment.

It is not a bug, it is a choice.

Changed in bash:
status: Confirmed → Rejected
Revision history for this message
dotancohen (dotancohen) wrote :

Though I could not get `~/.ssh.known_hosts` to not hash, I was able to configure SSH to use the `~/.ssh/config` file for autocompletion. Documented here:
http://unix.stackexchange.com/questions/136351/autocomplete-server-names-for-ssh-and-scp

Revision history for this message
Jarl (jarl-dk) wrote :

@dotancohen: For me, putting `HashKnownHosts no` into `~/.ssh/config` works fine.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.