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,
Best Answer
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
:Replace the values according to your host of course. Then login using an scp URL like this:
Most ssh cliets on Linux honour the client configuration file (also a sytem-wide one in
/etc/ssh/ssh_config
(not to be confused withsshd_config
). I hope your plugin will do so too. For more configuration options seeman ssh_config
. Debugging usingssh -vvv
usually helps you out.