linux 在Windows 10上使用SSH连接到远程服务器的最简单的方法?是否有VSCode扩展?

x6yk4ghg  于 2023-08-03  发布在  Linux
关注(0)|答案(1)|浏览(128)

在Windows 10上使用SSH连接到远程服务器最简单的方法是什么?是否有VSCode扩展可以执行此操作?下面.PEM文件的用途是什么?
我无法使用SSHVSCode on windows 10连接到位于aws远程ubuntu服务器。我使用的是Remote SSH扩展。我收到了Server.PEM文件沿着来自客户端的以下命令:

ssh -i ~/.ssh/Server.pem ubuntu@ec2-55-131-129-128.us-east-2.compute.amazonaws.com

字符串
我在extension提示符中选择Linux作为远程主机的平台。但我得到以下错误:

Visual Studio Code

Could not establish connection to "ec2-55-131-129-128.us-east-2.compute.amazonaws.com".

[Close Remote] [Retry] [More Actions...]


当我单击[More Actions...]按钮时,扩展要求我选择配置文件。我尝试与.PEM文件路径,但仍然是相同的错误。
下面是输出日志:

[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: remote-ssh@0.102.0
[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 Files\Oracle\Java\javapath\ssh.exe -V"
[16:48:05.863] Got error from ssh: spawn C:\Program Files (x86)\Common Files\Oracle\Java\javapath\ssh.exe ENOENT
[16:48:05.864] Checking ssh with "C:\Windows\system32\ssh.exe -V"
[16:48:05.869] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT
[16:48:05.869] Checking ssh with "C:\Windows\ssh.exe -V"
[16:48:05.876] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT
[16:48:05.877] Checking ssh with "C:\Windows\System32\Wbem\ssh.exe -V"
[16:48:05.880] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT
[16:48:05.881] Checking ssh with "C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[16:48:05.885] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[16:48:05.886] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.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:\Windows\System32\OpenSSH\ssh.exe" -T -D 51940 "ec2-55-131-129-128.us-east-2.compute.amazonaws.com" bash
[16:48:06.015] Terminal shell path: C:\Windows\System32\cmd.exe
[16:48:06.465] > ]0;C:\Windows\System32\cmd.exe
[16:48:06.466] Got some output, clearing connection timeout
[16:48:09.123] > ubuntu@ec2-55-131-129-128.us-east-2.compute.amazonaws.com: 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:\Users\HT\.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:584145)
    at t.handleInstallOutput (c:\Users\HT\.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:582705)
    at t.tryInstall (c:\Users\HT\.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:681881)
    at async c:\Users\HT\.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:644110
    at async t.withShowDetailsEvent (c:\Users\HT\.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:647428)
    at async t.resolve (c:\Users\HT\.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:645160)
    at async c:\Users\HT\.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:720916
[16:48:10.465] ------

lpwwtiir

lpwwtiir1#

您所做的操作看起来是正确的,但请确保您已允许访问安全组中的IP地址。
访问安全组页面,选择与您的EC2示例关联的组:网址:https://ap-southeast-2.console.aws.amazon.com/ec2/home?#SecurityGroups
编辑入站规则并确保有一个条目匹配'SSH'作为类型和您的ip地址/32作为'源',例如123.123.123/32

相关问题