--- layout: post status: publish published: true title: Fixing scp completion in Ubuntu 9.10 wordpress_id: 229 wordpress_url: http://pro.grammatic.org/post-fixing-scp-completion-in-ubuntu-910-73.aspx date: !binary |- MjAwOS0xMi0wNyAxMjo0MTozOSArMDEwMA== date_gmt: !binary |- MjAwOS0xMi0wNyAxMjo0MTozOSArMDEwMA== categories: - Technology - Linux tags: - ssh - Linux - scp comments: [] ---

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.

Download my fix: 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