通过 Cmder 进行的 SSH 没有查找正确的文件夹?

通过 Cmder 进行的 SSH 没有查找正确的文件夹?

我遇到了一个问题,我不知道发生了什么。
简而言之,我在 Windows 10 上,我使用全新安装的 Cmder。

当尝试通过 SSH 连接到我的 VPS 服务器时,出现以下警告:

Could not create directory '/home/username/.ssh'

显然在 Windows 上我的/.ssh/文件夹不是/home/username/.ssh但是C:\Users\username\.ssh

我已验证并且该文件夹已经存在。

奇怪的是,我的%HOME%环境变量好像是正确的,echo %HOME%在Cmder中输入时,输出的是C:\Users\username

我试过了,这是输出:ssh -v [email protected] -p 22

λ ssh -v [email protected] -p 22
OpenSSH_7.1p1, OpenSSL 1.0.2e 3 Dec 2015
debug1: Connecting to vpsXXXXXX.ovh.net [XXX.XXX.XX.XXX] port 22.
debug1: Connection established.
Could not create directory '/home/username/.ssh'.
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/username/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Debian-10
debug1: match: OpenSSH_7.4p1 Debian-10 pat OpenSSH* compat 0x04000000
debug1: Authenticating to vpsXXXXXX.ovh.net:22 as 'root'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client [email protected] <implicit> none
debug1: kex: client->server [email protected] <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:XxXXxXxXXXXXXXxXxXxXxXXXXxXxxXxxXXxxXXxxXXx
The authenticity of host 'vpsXXXXXX.ovh.net (XXX.XXX.XX.XXX)' can't be established.
ECDSA key fingerprint is SHA256:XxXXxXxXXXXXXXxXxXxXxXXXXxXxxXxxXXxxXXxxXXx.
Are you sure you want to continue connecting (yes/no)?

我怀疑某处安装了 OpenSSH,但我找不到它。
有人知道吗?

更新 1:

感谢你的建议@Maximus。
我意识到评论中的内容不可读,所以我尝试了以下方法。

正如@Maximus 所建议的,我尝试运行一个基本的 ConEmu shell,并注意到了一些差异。
在 Cmder shell 中,我运行了:

cd C:\cmder\vendor\conemu-maximus5 && ConEmu.exe -basic -run {bash}

然后我尝试通过 SSH 连接:

$ ssh -v [email protected] -p 22
OpenSSH_7.3p1, OpenSSL 1.0.2j  26 Sep 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to vpsXXXXXX.ovh.net [XXX.XXX.XX.XXX] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/username/.ssh/id_rsa type -1

这不是同一个 OpenSSH 版本,密钥文件夹路径没问题。
事实上我想使用 Cmder,那么如果 Cmder 定义了自己的变量,我该如何覆盖它们?

答案1

我终于找到了解决这个问题的方法。
卸载一些不再使用的 chocolatey 包后,Cmder 找到了正确的路径。

我卸载了、、android-sdk和。我 不清楚其中哪个有问题,但我高度怀疑是该软件包。genymotioncmakevirtualboxrsync
rsync

我不记得何时以及为何安装它,但我在玩一些配置文件时肯定犯了一个错误。

希望有一天这可以帮助到别人。

相关内容