vscode远程连接ssh

一. 使用vscode里的ssh查件连不上远程的解决方法

  1. 删除Windows上的known_host文件,该文件会在连接之后自动生成,用于验证远程服务器的身份。

  2. konwn_host和id_rsa,id_rsa.pub的关系

    (1)konwn_host用于客户端验证远程服务器的身份,id_rsa用于服务器验证客户端的身份,具体来说id_rsa生成一个随机签名发送到服务器,服务器用事先报错好的id_rsa.pub来验证该签名,从而实现登录。

    (2)所以要实现ssh远程连接必须要保证konwn_host是正确的,不正确就把其删除。

    (3)再比如连接github服务器,我们同样需要konwn_host验证github服务器的身份,同时需要github_rsa进行登录。
    gitbash中使用ssh代理免密登录记得ssh-keygen加上-f ~/.ssh/密钥对名称,来实现自定义密钥名
    (4)需要注意我们要在/etc/profiles中新增下面代码,保证能够每次启动都添加ssh代理

    bash 复制代码
    ssh_proxy_add(){
            eval $(ssh-agent -s)
            ssh-add ~/.ssh/id_rsa
            ssh-add ~/.ssh/github_rsa
    }
    ssh_proxy_add

二. 修改~/.ssh/config文件实现免密ssh连接

  1. 把公钥添加到要登录用户的~/.ssh/authorized_keys中
  2. 修改Windows的~/.ssh/config添加IdentityFile 指定私钥的位置
c 复制代码
Host remote
  HostName 47.108.186.16
  User root
  Port 22
  IdentityFile "C:\Users\Administrator\.ssh\aliyun_rsa"

链接

相关推荐
非得登录才能看吗?1 小时前
VScode 入门(设置篇)
ide·vscode·编辑器
Costrict4 小时前
解锁新阵地!CoStrict 现已支持 JetBrains 系列 IDE
大数据·ide·人工智能·深度学习·自然语言处理·ai编程·visual studio
AlphaFinance5 小时前
Windows下Vscode连接到WSL的方法
ide·vscode·编辑器
Dobby_055 小时前
【Go】C++ 转 Go 第(二)天:变量、常量、函数与init函数
vscode·golang·go
这周也會开心12 小时前
通过ssh连接GitHub远程仓库
运维·ssh·github
JohnYan13 小时前
工作笔记 - VSCode ssh远程开发
javascript·ssh·visual studio code
techdashen20 小时前
圆桌讨论:Coding Agent or AI IDE 的现状和未来发展
ide·人工智能
止观止21 小时前
如何开发 VSCode 内置扩展:从零开始构建最简扩展
ide·vscode·编辑器
CHH32131 天前
在 Mac/linux 的 VSCode 中使用Remote-SSH远程连接 Windows
linux·windows·vscode·macos
Aevget1 天前
「Java EE开发指南」用MyEclipse开发的EJB开发工具(二)
java·ide·java-ee·eclipse·myeclipse