windows 设置 vscode 免密远程

我们可以使用 vscode ssh 进行远程编辑文件项目。

也可以使用 ssh 密匙 来实现免密登录。

本人在本地windows系统有多个密匙,使用 D:\SPB_Data\.ssh\id_rsa_local 进行本地设备进行登录。

在 vscode ssh 配置文件中添加 IdentityFile 配置

bash 复制代码
Host 本地设备ip
  HostName 192.168.99.132
  User hocker
  IdentityFile "D:\SPB_Data\.ssh\id_rsa_local"

由于文件权限,会报错:

bash 复制代码
[14:21:53.194] Got some output, clearing connection timeout
[14:21:53.279] > Bad permissions. Try removing permissions for user: NT AUTHORITY\\Authenticated 
> Users (S-1-5-11) on file D:/SPB_Data/.ssh/id_rsa_local.
[14:21:53.285] > @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
> Permissions for 'D:\\SPB_Data\\.ssh\\id_rsa_local' are too open.        
> It is required that your private key files are NOT accessible by others.
> This private key will be ignored.
> Load key "D:\\SPB_Data\\.ssh\\id_rsa_local": bad permissions
> hocker@192.168.99.132's password:

对 D:\SPB_Data.ssh\id_rsa_local 文件进行权限限制, cmd 中运行

cmd 复制代码
icacls "D:\SPB_Data\.ssh\id_rsa_local"
icacls "D:\SPB_Data\.ssh\id_rsa_local" /inheritance:r /grant:r "%USERNAME%:(R)"

然后就能够免密登录了。

相关推荐
易点云徐源2 小时前
(已解决)BOSS直聘 Windows 客户端一直“加载中,请稍候”怎么办?
windows
绮罗郁金香2 小时前
windows延迟更新
windows
苏生Susheng4 小时前
【软件实施】Windows 服务器运维实战
java·运维·服务器·windows·spring boot·javaweb·实施
方向研究4 小时前
UEFI/Windows启动流程
windows
ZnS_oscar4 小时前
不用下载字体,获得仿宋字体
windows·word
面包狗AI4S4 小时前
Codex/ChatGPT 反复 Reconnecting(正在重新连接) 5/5 的最简修复方法
人工智能·vscode·chatgpt
霸道流氓气质5 小时前
通义千问 Chat 模型高级用法:Function Calling / Structured Output / 多轮对话
linux·运维·windows
Boop_wu5 小时前
[LangGraph] 案例 2 : 支持搜索的智能代理系统
服务器·windows·python·langchain
啦啦啦~~~2225 小时前
PC端+安卓端阅读器推荐!开源本地小说阅读器软件,
android·论文阅读·windows·开源软件·福昕阅读器
与自己和解7415 小时前
使用ssh实现 VScode 直连 ubuntu
vscode·ubuntu·ssh