windows使用ssh免密登录报错

windows使用ssh免密登录报错

提出问题

报错信息1

Bad owner or permissions on C:\\Users\\Administrator/.ssh/config

报错信息2

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions for '.\\xxx.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key ".\\xxx.pem": bad permissions

或者

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '/root/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/root/.ssh/id_rsa": bad permissions
Permission denied (publickey).

说明

之前使用 dos 命令不用免密登录是可以的 , 后来配置了公私钥 , 使用 git bash 命令行可以实现免密登录 , 后面一直用的就是git bash , 很少使用 dos 命令行 , 今天测试 vscode 远程编码功能 , 使用免密登录云服务器发现登录失败 , 后来查找了很多资料 , 并没有解决 , 找到了一篇帖子 , 说是 windows 的 open-ssh 的问题 , 后面我替换windows的open-ssh , 改为 git 的ssh , 问题解决 , 也许有别的解决方案 , 但是我试了 , 没有用

open ssh 替换为 git ssh

open-ssh 和 git ssh 的 ssh.exe 程序位置

open ssh 命令执行位置
%SYSTEMROOT%\System32\OpenSSH\

git ssh 命令的执行位置(这个根据 git 位置决定)
D:\git\Git\usr\bin

如图 : git ssh 运行程序的位置

image-20211119215450781

1.path 环境变量中删除 open-ssh 的变量

image-20211119215641863

2.path 环境变量中添加 git ssh

image-20211119215809639

到此 windows dos 命令行可以使用 ssh 免密登录

连接成功

image-20211119215946654

猜你喜欢

转载自blog.csdn.net/shaoming314/article/details/121431976