← Back to list
2025-08-30T11:22:24.657ZLinux

VSCode远程连接服务器

Linux

本文介绍如何通过 VS Code 的 Remote - SSH 扩展连接远程服务器,并记录常见的 私钥权限过宽 报错与处理方式(Windows / Linux)。

前置准备

《VSCode远程连接服务器》文章正文配图 — STARBUCKET BLOG

  1. 安装 Visual Studio Code(VS Code)。

安装扩展

  1. 打开 VS Code 的扩展市场。
  2. 搜索并安装:Remote - SSH(扩展名通常为 ms-vscode-remote.remote-ssh)。

配置 SSH 连接

  1. 在 VS Code 中打开 Remote - SSH 相关入口(命令面板 / 远程资源管理器)。
  2. 打开 SSH 配置文件(常见为 ~/.ssh/config,Windows 也可能在用户目录下的 .ssh 中)。
  3. 按你的服务器信息补充 HostHostNameUserIdentityFile 等字段(按需填写)。

配置示例(按需修改)

Host my-server
  HostName 1.2.3.4
  User ubuntu
  IdentityFile ~/.ssh/your_key.pem

Comments & discussion

The first comment in each thread opens a topic. Signed-in readers can keep the conversation going under that topic.

No comments yet. Sign in to start a topic.

Start a new topic

Sign in to start a topic or join the discussion.