SSH 在 Windows 10 上找不到 id_rsa 和 id_rsa.pub 文件

SSH 在 Windows 10 上找不到 id_rsa 和 id_rsa.pub 文件

id_rsaid_rsa.pub位于K:\Batch\mySSH,脚本K:\Batch\mySSH\runme.cmd从 Excel 调用(通过 VBA),包含以下内容:

pushd %~dp0
  set home=%CD:~0,2%\Batch\mySSH
  %home%\ssh -v -o LogLevel=Verbose [email protected] "do something"
popd
  • runme.cmd输出:
    OpenSSH_for_Windows_8.1p1, LibreSSL 2.9.2
    
    debug1: Connecting to 11.111.111.11 [11.111.111.11] port 22.
    debug1: Connection established.
    debug1: identity file C:\\Users\\johnDoe/.ssh/id_rsa type -1
    ...
    debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
    debug1: Will attempt key: C:\\Users\\johnDoe/.ssh/id_rsa
    ...
    debug1: Next authentication method: publickey
    debug1: Trying private key: C:\\Users\\johnDoe/.ssh/id_rsa
    

我如何确保它寻找K:\Batch\mySSH\.ssh\id_rsa而不是定位C:\Users\johnDoe\.ssh

答案1

确保该-i参数用于指定您的身份文件;例如更改:

相关内容