DEV Community

SSH to an EC2 instance from VS Code

Damilare Joseph on March 09, 2020

Requirements: 1) You must have VSCode or VSCode Insider installed. 2) A running SSH server preferrable a linux server running on an EC2 instan...
Collapse
 
ydekel6 profile image
ydekel6 • Edited

my computer uses windows. should I insert in IdentityFile the full path including c:/? also, should I use the .pem or .ppk file?
I keep getting the following error:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
[18:37:12.028] > The process tried to write to a nonexistent pipe.
[18:37:12.341] "install" terminal command done
[18:37:12.342] Install terminal quit with output: The process tried to write to a nonexistent pipe.
[18:37:12.342] Received install output: The process tried to write to a nonexistent pipe.
[18:37:12.343] Resolver error: The process tried to write to a nonexistent pipe

Collapse
 
efleurine profile image
Emmanuel

did you ever solved it?

Collapse
 
gcrumpley profile image
Guy Crumpley

You just need to enter the full path IN QUOTES using the normal backslashes. :)

Collapse
 
marcusturewicz profile image
Marcus Turewicz

Thanks for the post.

I was getting the error "permission 0644 are too open ssh" because I hadn't set my pem file to be only readable by me:

stackoverflow.com/a/9270753/6939988

After this, it worked.

Collapse
 
imspikey profile image
imspikey

Thanks that was the most accurate explanation and the only tutorial that worked for me

Collapse
 
gcrumpley profile image
Guy Crumpley • Edited

Fun fact: OpenSSH client will hang on the initial connection UNLESS you either: 1) Import the remote SSH server as a "known host"; OR, 2) Relax your security for the initial connection (below).

DISABLE StrictHostKeyChecking in your ssh config file in order to avoid initial connection failures. Something like this (only the last line is relevant to solving this problem):

Host [Your Connection Name]
HostName [AWS external DNS]
User [Typically "ec2-user for community AMIs, but Ubuntu user is "ubuntu"]
IdentityFile [Full file path with quotes if spaces are included]
StrictHostKeyChecking no