What is the easiest way to connect to remote server using SSH on Windows 10? Is there a VSCode extension to do this? What is the purpose of .PEM
file below?
I am unable to connect to remote ubuntu
server at aws
from VSCode on windows 10
using SSH
. I am using Remote SSH
extension. I have received Server.PEM
file along with following command from my client:
ssh -i ~/.ssh/Server.pem [email protected]
I select Linux
for platform of remote host in extesion prompt. But I am getting following error:
Visual Studio Code
Could not establish connection to "ec2-55-131-129-128.us-east-2.compute.amazonaws.com".
[Close Remote] [Retry] [More Actions...]
When I click [More Actions...]
button, the extension ask me to select configuration file. I tried with .PEM
file path but still the same error.
Here is the output log:
[16:47:03.391] Log Level: 2
[16:47:03.456] SSH Resolver called for "ssh-remote+ec2-55-131-129-128.us-east-2.compute.amazonaws.com", attempt 1
[16:47:03.457] "remote.SSH.useLocalServer": false
[16:47:03.458] "remote.SSH.showLoginTerminal": false
[16:47:03.459] "remote.SSH.remotePlatform": {}
[16:47:03.474] "remote.SSH.path": undefined
[16:47:03.475] "remote.SSH.configFile": undefined
[16:47:03.476] "remote.SSH.useFlock": true
[16:47:03.476] "remote.SSH.lockfilesInTmp": false
[16:47:03.477] "remote.SSH.localServerDownload": auto
[16:47:03.477] "remote.SSH.remoteServerListenOnSocket": false
[16:47:03.479] "remote.SSH.showLoginTerminal": false
[16:47:03.479] "remote.SSH.defaultExtensions": []
[16:47:03.480] "remote.SSH.loglevel": 2
[16:47:03.481] "remote.SSH.enableDynamicForwarding": true
[16:47:03.481] "remote.SSH.enableRemoteCommand": false
[16:47:03.481] "remote.SSH.serverPickPortsFromRange": {}
[16:47:03.482] "remote.SSH.serverInstallPath": {}
[16:47:03.496] VS Code version: 1.80.1
[16:47:03.496] Remote-SSH version: [email protected]
[16:47:03.496] win32 x64
[16:47:03.502] SSH Resolver called for host: ec2-55-131-129-128.us-east-2.compute.amazonaws.com
[16:47:03.503] Setting up SSH remote "ec2-55-131-129-128.us-east-2.compute.amazonaws.com"
[16:47:03.520] Using commit id "74f6148eb9ea00507ec113ec51c489d6ffb4b771" and quality "stable" for server
[16:47:03.540] Install and start server if needed
[16:48:05.855] Checking ssh with "C:Program Files (x86)Common FilesOracleJavajavapathssh.exe -V"
[16:48:05.863] Got error from ssh: spawn C:Program Files (x86)Common FilesOracleJavajavapathssh.exe ENOENT
[16:48:05.864] Checking ssh with "C:Windowssystem32ssh.exe -V"
[16:48:05.869] Got error from ssh: spawn C:Windowssystem32ssh.exe ENOENT
[16:48:05.869] Checking ssh with "C:Windowsssh.exe -V"
[16:48:05.876] Got error from ssh: spawn C:Windowsssh.exe ENOENT
[16:48:05.877] Checking ssh with "C:WindowsSystem32Wbemssh.exe -V"
[16:48:05.880] Got error from ssh: spawn C:WindowsSystem32Wbemssh.exe ENOENT
[16:48:05.881] Checking ssh with "C:WindowsSystem32WindowsPowerShellv1.0ssh.exe -V"
[16:48:05.885] Got error from ssh: spawn C:WindowsSystem32WindowsPowerShellv1.0ssh.exe ENOENT
[16:48:05.886] Checking ssh with "C:WindowsSystem32OpenSSHssh.exe -V"
[16:48:05.993] > OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
[16:48:05.994] >
[16:48:06.010] Running script with connection command: "C:WindowsSystem32OpenSSHssh.exe" -T -D 51940 "ec2-55-131-129-128.us-east-2.compute.amazonaws.com" bash
[16:48:06.015] Terminal shell path: C:WindowsSystem32cmd.exe
[16:48:06.465] > ]0;C:WindowsSystem32cmd.exe
[16:48:06.466] Got some output, clearing connection timeout
[16:48:09.123] > [email protected]: Permission denied (pu
> blickey).
[16:48:09.135] > The process tried to write to a nonexistent pipe.
[16:48:10.431] "install" terminal command done
[16:48:10.432] Install terminal quit with output: blickey).
[16:48:10.432] Received install output: blickey).
[16:48:10.434] Failed to parse remote port from server output
[16:48:10.442] Resolver error: Error:
at m.Create (c:UsersHT.vscodeextensionsms-vscode-remote.remote-ssh-0.102.0outextension.js:1:584145)
at t.handleInstallOutput (c:UsersHT.vscodeextensionsms-vscode-remote.remote-ssh-0.102.0outextension.js:1:582705)
at t.tryInstall (c:UsersHT.vscodeextensionsms-vscode-remote.remote-ssh-0.102.0outextension.js:1:681881)
at async c:UsersHT.vscodeextensionsms-vscode-remote.remote-ssh-0.102.0outextension.js:1:644110
at async t.withShowDetailsEvent (c:UsersHT.vscodeextensionsms-vscode-remote.remote-ssh-0.102.0outextension.js:1:647428)
at async t.resolve (c:UsersHT.vscodeextensionsms-vscode-remote.remote-ssh-0.102.0outextension.js:1:645160)
at async c:UsersHT.vscodeextensionsms-vscode-remote.remote-ssh-0.102.0outextension.js:1:720916
[16:48:10.465] ------
2
Answers
It turns out my VS Code got garbage! I have to Completely uninstall VsCode,
What you are doing looks correct, but ensure you have allowed access to your IP address in the security group.
Visit the security group page and select the group associated with your EC2 instance: https://ap-southeast-2.console.aws.amazon.com/ec2/home?#SecurityGroups:
Edit the inbound rules and ensure there is an entry which matches ‘SSH’ as the Type and your ip address/32 as the ‘Source’, eg 123.123.123/32