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

然后就能够免密登录了。

相关推荐
小羊没烦恼!4 天前
初探性能优化——2个月到4小时的性能提升
java·开发语言·windows·算法·c#
rockmelodies4 天前
# Windows Server2008 R2 Standard(SP1镜像U盘)重置本地管理员密码【完整详细步骤】
windows·密码破解
kakakahahahaha5 天前
Windows C盘空间不足的安全清理与迁移流程
windows·电脑·笔记本电脑·软件需求·c盘清理
做咩啊~5 天前
远程连接提示:身份验证错误,要求的函数不受支持
windows
2501_915909065 天前
移动端开发工具链怎么组合比较好,iOS、Android、跨端三套配置方案
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
百事牛科技5 天前
PPT只读怎么取消?四种情况分别处理
windows·powerpoint
sunoo-2295 天前
【ARM嵌入式学习笔记Day6】一文打通i.MX6ULL时钟体系:PLL/PFD/预分频+滞回比较器全解析
arm开发·笔记·vscode·单片机·imx6ull·汇编语言
明天…ling5 天前
gitee与vscode远程连接
vscode·gitee
2501_915918415 天前
iOS编程用什么软件好?主流工具Xcode、AppCode、CodeRunner与新兴快蝎对比
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
熊明才5 天前
WSL2 网络突然瘫痪(Network is unreachable / 没有 eth0)最短修复指南(2026年9月20日亲测可用)
linux·windows·wsl2