Fixing scp completion in Ubuntu 9.10

Originally published on eve.gd on 7 December 2009, last updated 6 September 2026.

Read this post on the web (with images, PDF and citation details)

Currently, owing to a bug, scp in Kubuntu and Ubuntu 9.10 (Karmic Koala) does not allow you to autocomplete remote directories (when you have a passwordless ssh setup, obviously).

While I have submitted a patch for review, this will not be backported into 9.10 and so, those who wish to have this functionality, should follow these steps:

Visit this bug to read about the problem. Note that this is a problem with bash-completion, not with scp itself.

this bug

Download my fix: bash-completion scp fix for Ubuntu 9.10.

bash-completion scp fix for Ubuntu 9.10

Backup your current file:

sudo cp /etc/bash_completion.d/ssh ~/ssh_backup

Copy the downloaded file to /etc/bash_completion.d/:

sudo cp ./ssh /etc/bash_completion.d/

Restart your bash session and you should have working scp remote completion! ie. scp remotehost:~/myfi[TAB] will complete to remotehost:/home/you/myfile.txt

Note: I am not responsible for any damage this causes - it is not an official patch and I am unable to provide tech support. If you find problems with the fix, please report them to the official bug posted above which is more likely to get a response.

If anything goes wrong, you can restore the old configuration using:

sudo cp ~/ssh_backup /etc/bash_completion.d/ssh

References

This reference list has been generated, in many cases, through an automated process and may therefore contain errors or incomplete metadata. It is provided purely as assistance for finding the items mentioned within this post.

1. bash-completion scp fix for Ubuntu 9.10 <http://launchpadlibrarian.net/35968198/ssh>

2. ‘Bug #449349 "regression for completing remote files/dirs over ssh..."’, Launchpad <https://bugs.launchpad.net/ubuntu/karmic/+source/bash-completion/+bug/449349>

http://launchpadlibrarian.net/35968198/ssh
https://bugs.launchpad.net/ubuntu/karmic/+source/bash-completion/+bug/449349