win10环境下VSCode Remote

环境准备

  • 本地操作系统使用win10 1809以上,这个版本自带Open SSH Client,可以省去ssh的配置
  • 远程Linux主机打开SSH密钥登录设置:PubkeyAuthentication yes

本地win10生成密钥对

ssh-keygen -t rsa -b 4096 -f D:DevEnvconfsshid_rsa-remote-ssh

远程Linux主机配置

上传生成的密钥对(id_rsa-remote-ssh和id_rsa-remote-ssh.pub)到Linux的相应用户下,执行:

ssh-copy-id -i id_rsa-remote-ssh.pub 192.168.0.8

也可以手工配置,但通过ssh-copy-id命令配置,可以为用户主目录(home)和~/.ssh, 和~/.ssh/authorized_keys设置合适的权限
完成后删除id_rsa-remote-ssh和id_rsa-remote-ssh.pub

设置vscode的Remote - SSH插件配置文件:

Host 192.168.0.8
    HostName 192.168.0.8
    User ubuntu
    IdentityFile  D:DevEnvconfsshid_rsa-remote-ssh
原文地址:https://www.cnblogs.com/javaite/p/10868787.html