where ssh
C:\Windows\System32\OpenSSH\ssh.exe
C:\Program Files\OpenSSH-Win64\ssh.exe
我有一个ssh_config
存储在 下C:\Users\my-username\.ssh\ssh_config
。其中有以下内容:
Host ucp.local
AddKeysToAgent yes
ForwardAgent no
ForwardX11 no
HostName ucp.local
User web
Port 22
IdentityFile D:\Projects\client\shop\keys\dev
LogLevel DEBUG
该ucp.local
域名映射到本地 IP 并按预期工作:
Pinging ucp.local [192.168.33.10] with 32 bytes of data:
Reply from 192.168.33.10: bytes=32 time<1ms TTL=64
Reply from 192.168.33.10: bytes=32 time<1ms TTL=64
Reply from 192.168.33.10: bytes=32 time<1ms TTL=64
Reply from 192.168.33.10: bytes=32 time<1ms TTL=64
我的问题是,当我尝试使用ssh ucp.local
它时,它似乎没有使用该ssh_config
文件,因为它要求我使用我的 Windows 用户名登录skrimble
...[email protected]
而不是web
按照定义ssh_config
我尝试过谷歌搜索,但似乎找不到解决方案。我使用的 SSH 版本是:
ssh ucp.local -v
OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
debug1: Connecting to ucp.local [192.168.33.10] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Skrimble/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Skrimble/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Skrimble/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Skrimble/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Skrimble/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Skrimble/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Skrimble/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Skrimble/.ssh/id_ed25519-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Skrimble/.ssh/id_xmss type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Skrimble/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 pat OpenSSH* compat 0x04000000
debug1: Authenticating to ucp.local:22 as 'skrimble'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:f5ZhPsTYy3qV4aaRuct7ycOgB/CuC3MiD8QAgqYYp2A
debug1: Host 'ucp.local' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\Skrimble/.ssh/known_hosts:8
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: C:\\Users\\Skrimble/.ssh/id_rsa
debug1: Trying private key: C:\\Users\\Skrimble/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\Skrimble/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\Skrimble/.ssh/id_ed25519
debug1: Trying private key: C:\\Users\\Skrimble/.ssh/id_xmss
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
[email protected]'s password:
知道我做错了什么吗?
编辑:重命名ssh_config
为config
。我仍然得到相同的结果:
C:\Users\Skrimble>ssh ucp.local -v
OpenSSH_for_Windows_8.0p1, LibreSSL 2.6.5
debug1: Connecting to ucp.local [192.168.33.10] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\Skrimble/.ssh/id_rsa type -1
debug1: identity file C:\\Users\\Skrimble/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\Skrimble/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\Skrimble/.ssh/id_dsa-cert type -1
debug1: identity file C:\\Users\\Skrimble/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\Skrimble/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\Skrimble/.ssh/id_ed25519 type -1
debug1: identity file C:\\Users\\Skrimble/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\Skrimble/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\Skrimble/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.0
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to ucp.local:22 as 'skrimble'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:f5ZhPsTYy3qV4aaRuct7ycOgB/CuC3MiD8QAgqYYp2A
debug1: read_passphrase: can't open /dev/tty: No such file or directory
The authenticity of host 'ucp.local (192.168.33.10)' can't be established.
ECDSA key fingerprint is SHA256:f5ZhPsTYy3qV4aaRuct7ycOgB/CuC3MiD8QAgqYYp2A.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'ucp.local,192.168.33.10' (ECDSA) to the list of known hosts.
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: C:\\Users\\Skrimble/.ssh/id_rsa
debug1: Will attempt key: C:\\Users\\Skrimble/.ssh/id_dsa
debug1: Will attempt key: C:\\Users\\Skrimble/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\Skrimble/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\Skrimble/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: C:\\Users\\Skrimble/.ssh/id_rsa
debug1: Trying private key: C:\\Users\\Skrimble/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\Skrimble/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\Skrimble/.ssh/id_ed25519
debug1: Trying private key: C:\\Users\\Skrimble/.ssh/id_xmss
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
[email protected]'s password: