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)"

然后就能够免密登录了。

相关推荐
hui函数1 天前
如何解决 PyCharm 控制台 pip install 报错 UnicodeDecodeError/GBK 路径编码问题
ide·pycharm·pip
zhaqonianzhu1 天前
【vsc】cpptools占用内存过大
vscode
码农水水1 天前
中国邮政Java面试:热点Key的探测和本地缓存方案
java·开发语言·windows·缓存·面试·职场和发展·kafka
沫离痕1 天前
windows安装docker实例
windows·docker·容器
桌面运维家1 天前
vDisk VOI架构IO瓶颈怎么办?Windows优化实战
windows·架构
智慧地球(AI·Earth)1 天前
Codex配置问题解析:wire_api格式不匹配导致的“Reconnecting...”循环
开发语言·人工智能·vscode·codex·claude code
「QT(C++)开发工程师」1 天前
我的 TRAE 编程体验-简介篇
ide·trae
AI大佬的小弟1 天前
pycharm专业版有哪些功能?
ide·pycharm·pycharm专业版的功能·代码写作软件推荐
非凡ghost1 天前
MPC-QT视频播放器(基于Qt框架播放器)
开发语言·windows·qt·音视频·软件需求
从此不归路1 天前
FPGA 结构与 CAD 设计(第3章)上
ide·fpga开发