SFTP files using key pair (not password)

Asked by Jack Clayton on 2010-04-16

Hi guys,

First, what an awesome plugin! Thanks for all the hard work. I spent a little time working on this one (mostly because I'm a noob), but I figured it out. I figured I'd post an answered question if any body needed help later.

I'm trying to use bzr-upload to upload changes to a website on Amazon Web Services EC2 service. I use a key pair instead of a password to SSH into the server.

I copied my key.pem file to my development server where I run bazaar, but I couldn't figure out how to use the pem file with sftp. Wherever I include it in the bzr-upload command (e.g. $ bzr upload key.pem sftp://username@host/path/to/files), bzr told me "bzr: ERROR: extra argument to command upload". Well, that makes sense, but there has to be a way.

Turns out you need to edit (or create if it doesn't exist) a file in your home directory.
$ mkdir ~/.ssh/config

Now you add two lines to tell SSH your host and the location of your pem file.
Host XXX.XXX.XXX.XXX
IdentityFile /path/to/key/file

(where XXX.XXX.XXX.XXX is your instance's ip address). That's it.

Happy SFTPing!

Question information

Language:
English Edit question
Status:
Solved
For:
bzr Upload plugin Edit question
Assignee:
No assignee Edit question
Solved by:
Jack Clayton
Solved:
2010-04-16
Last query:
2010-04-16
Last reply:

I already answered my own question... problem solved.