Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Currently, I am trying to edit a file on a remote server using Vim's built-in netrw plugin. I can SSH fine into my Amazon EC2 server using a command like this:

ssh -i <keyfile> bitname@<ec2-address>

However, I'd like to be able to use my own Vim configurations and have been trying to use scp like this:

:e scp://user@<ec2-address>//

But without a parameter to enter my keyfile, I get a permission denied (publickey) error.

Is there a parameter that I can use to enter my keyfile or another solution I am overlooking?

Thanks in advance,

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I haven't got Vim's netrw plugin, but try the following.

Create an ssh client config file for your host. Put the following in $HOME/.ssh/config:

Host myserveralias
Hostname ec-address
User user
IdentityFile /path/to/keyfile
PasswordAuthentication no

Replace the values according to your host of course. Then login using an scp URL like this: :e scp://myserveralias//.

Most ssh cliets on Linux honour the client configuration file (also a sytem-wide one in /etc/shh/ssh_config (not to be confused with sshd_config). I hope your plugin will do so too. For more configuration options see man ssh_config. Debugging using ssh -vvv usually helps you out.

share|improve this answer
    
Thank you! This worked perfectly. Another alternative solution I found was to use Transmit to mount as a drive. Then using Terminal, I could open up the files in Vim. –  Delos Chang Sep 14 '12 at 0:54
    
@DelosChang Great to hear it works out. Consider accepting the answer. :) –  gertvdijk Sep 14 '12 at 1:10
    
Done! Thank you for all your help :) –  Delos Chang Sep 14 '12 at 18:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.