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"

链接

相关推荐
涛ing31 分钟前
32. C 语言 安全函数( _s 尾缀)
linux·c语言·c++·vscode·算法·安全·vim
还是鼠鼠2 小时前
图书管理系统 Axios 源码__新增图书
前端·javascript·vscode·ajax·前端框架·node.js·bootstrap
maply5 小时前
VSCode 中的 Git Graph扩展使用详解
ide·git·vscode·编辑器·扩展
还是鼠鼠5 小时前
图书管理系统 Axios 源码 __删除图书功能
前端·javascript·vscode·ajax·前端框架·node.js·bootstrap
花花鱼5 小时前
vscode script 中间的function import等关键字 先高亮,然后又灰了,并且按ctrl+/ 注释以html的形式,导致报错处理
ide·vscode·编辑器
恋猫de小郭7 小时前
Android Studio 正式版 10 周年回顾,承载 Androider 的峥嵘十年
android·ide·android studio
还是鼠鼠7 小时前
图书管理系统 Axios 源码__编辑图书
前端·javascript·vscode·ajax·前端框架
Q168496451516 小时前
基于VMware的ubuntu与vscode建立ssh连接
vscode·ubuntu·ssh
davenian16 小时前
< OS 有关 > 阿里云 几个小时前 使用密钥替换 SSH 密码认证后, 发现主机正在被“攻击” 分析与应对
ubuntu·阿里云·ssh·网络攻击·fail2ban
老大白菜18 小时前
Windsurf cursor vscode+cline 与Python快速开发指南
ide·vscode·python