关于:使用管理员帐户和公钥登录 Windows 10 OpenSSH 服务器

关于:使用管理员帐户和公钥登录 Windows 10 OpenSSH 服务器

我被指示开始一个新问题:使用管理员帐户和公钥登录 Windows 10 OpenSSH 服务器

我已按照此处的建议操作,但仍然提示我输入密码。

icacls %USERPROFILE%\.ssh\authorized_keys

icacls c:\programdata\ssh\administrators_authorized_keys

印刷

C:\Users\someone\.ssh\authorized_keys NT AUTHORITY\SYSTEM:(F)
                                       BUILTIN\Administrators:(F)
                                       SOME\someone:(F)

两个文件的内容相同。它们与以下内容相匹配:

c:\Users\someone\.ssh\id_rsa.pub

c:\ProgramData\ssh\sshd_config(减去注释行)包含

SyslogFacility LOCAL0
LogLevel DEBUG3
StrictModes yes
PubkeyAuthentication yes
AuthorizedKeysFile  .ssh/authorized_keys
PasswordAuthentication no
GSSAPIAuthentication no
Subsystem   sftp    sftp-server.exe

如果我取消注释,结果是一样的:

Match Group administrators
      AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys

使用 ssh -vvv someone@localhost

从 sshd 启动控制台后没有记录任何内容,即我尝试登录后没有记录任何内容。

ssh 打印到控制台:

OpenSSH_for_Windows_8.1p1, LibreSSL 2.9.2
debug1: Connecting to localhost [::1] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\some/.ssh/id_rsa type 0
debug1: identity file C:\\Users\\some/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\some/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\some/.ssh/id_dsa-cert type -1
debug1: identity file C:\\Users\\some/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\some/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\some/.ssh/id_ed25519 type -1
debug1: identity file C:\\Users\\some/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\some/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\some/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version MS_1.100
debug1: no match: MS_1.100
debug1: Authenticating to localhost:22 as 'some'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: ecdh-sha2-nistp256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:pAdLIZxB6Ekw2II8ZtBIrIfXBItei16i4164bQSpdSA
debug1: Host 'localhost' is known and matches the RSA host key.
debug1: Found key in C:\\Users\\some/.ssh/known_hosts:1
debug1: rekey out after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 4294967296 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: C:\\Users\\some/.ssh/id_rsa RSA SHA256:gQP7gu2KaoJVtwxeYpBeqyi/EshC3uaPtnzd2avi0pI
debug1: Will attempt key: C:\\Users\\some/.ssh/id_dsa
debug1: Will attempt key: C:\\Users\\some/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\some/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\some/.ssh/id_xmss
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: gssapi-with-mic,password
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
some@localhost's password:

以下是 sshd -d 的输出

debug1: sshd version OpenSSH_for_Windows_8.1, LibreSSL 2.9.2
debug1: private host key #0: ssh-rsa SHA256:oKN60O0yPPCOhZhrx5ofoPvjlKST+Sp4U2FDBXFlbR0
debug1: private host key #1: ecdsa-sha2-nistp256 SHA256:3nDlWzmbKh7y/VOf+SmFNQkb9vIQv4mA76RS3GZ6EaI
debug1: private host key #2: ssh-ed25519 SHA256:Qsrp2KAHkstmi+3eBdeeEhKb9pnAjvl3nTSLoVplucs
debug1: rexec_argv[0]='C:\\Program Files\\OpenSSH\\sshd.exe'
debug1: rexec_argv[1]='-d'
debug1: Bind to port 22 on ::.
Server listening on :: port 22.
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.

我能做些什么?

相关内容