ssh警告尽管有效权限,但未保护的密钥文件-使用cygwin / Windows 10

时间:2019-07-11 22:27:38

标签: ssh cygwin

我正在尝试从运行Windows 10的PC上使用cygwin。我将ssh密钥放入/cygdrive/c/users/admin/.ssh/并设置权限:

$ ls -l /cygdrive/c/users/admin/.ssh/
total 25
-rw-------+ 1 vscadmin Users 2727 Jul 11 17:44 id_rsa
-rw-------+ 1 vscadmin Users  752 Jul 11 17:44 id_rsa.pub
-rw-------+ 1 vscadmin Users 2545 Jul 11 17:44 id_rsa-cert.pub
-rw-------+ 1 vscadmin Users 2727 Jul 11 17:44 user2_rsa
-rw-------+ 1 vscadmin Users  752 Jul 11 17:44 user2_rsa.pub
-rw-------+ 1 vscadmin Users 2545 Jul 11 17:44 user2_rsa-cert.pub
-rw-------+ 1 vscadmin Users  175 Feb 14 19:15 known_hosts

但是我得到了这个不受保护的密钥文件错误:

$ ssh -T -v sensuser@192.168.1.53
OpenSSH_for_Windows_7.6p1, LibreSSL 2.6.4
debug1: Connecting to 192.168.1.53 [192.168.1.53] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\admin/.ssh/id_rsa type 0
debug1: identity file C:\\Users\\admin/.ssh/id_rsa-cert type 4
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\admin/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\admin/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\admin/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\admin/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\admin/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\admin/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.5
debug1: match: OpenSSH_7.5 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.1.53:22 as 'sensity'
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: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:CtcBtaY5J2A0Hmd+cdsfoykDn7/blahblahGj99857s
debug1: Host '192.168.1.53' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\admin/.ssh/known_hosts:1
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,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:MbshWTLrnmkvsGjZaNpndsp23kqNdtCPZkNALlfEnCE C:\\Users\\admin/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Offering public key: RSA-CERT SHA256:MbshWTLrnmkvsGjZaNpndsp23kqNdtCPZkNALlfEnCE C:\\Users\\admin/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa-cert-v01@openssh.com blen 1866
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions for 'C:\\Users\\admin/.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 "C:\\Users\\admin/.ssh/id_rsa": bad permissions
debug1: Trying private key: C:\\Users\\admin/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\admin/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\admin/.ssh/id_ed25519
no such identity: C:\\Users\\admin/.ssh/id_ed25519: No such file or directory
debug1: Next authentication method: keyboard-interactive
debug1: read_passphrase: can't open /dev/tty: No such file or directory

我认为问题可能是我修改了错误的文件之一,但是如果我从该目录中删除id_rsa文件,那么基本上它甚至没有达到上述过程的程度。

0 个答案:

没有答案