Cygwin ssh 带密钥错误-指定的登录会话不存在

Cygwin ssh 带密钥错误-指定的登录会话不存在

更新:此问题仅出现在 上Windows server 2008 R2。我创建了一个Windows server 2012 R2虚拟机,它运行良好。

我想通过 ssh 运行一些 Windows 查询,但这是一个有趣的问题,我无法找到其原因。

使用密钥进行身份验证时出现以下错误:

root@ubunutu: ssh -t  [email protected] "schtasks /query"
ERROR: A specified logon session does not exist. It may already have been terminated.

GPO“不允许存储网络身份验证的密码和凭据”已被禁用。

如果我使用密码验证并返回查询的输出,它就可以正常工作。

-D如果我使用或启动远程 cygwin 服务器上的 sshd,-d然后使用密钥或密码进行身份验证,它也会起作用。

更新:只要服务由我们验证的同一用户启动,它就可以工作。username@cygserver: /usr/sbin/sshd.exe

默认情况下cygrunsrv --start sshd以 SERVER_NAME/cyg_server 用户启动。

username@cygserver: /usr/sbin/sshd.exe -D
or
username@cygserver: /usr/sbin/sshd.exe

root@ubunutu: ssh -t  [email protected] "schtasks /query"

...output of all schedule tasks

其他 Windows 命令运行良好。

使用按键时的调试日志:

debug3: Ignored env LOGNAME
debug3: Ignored env SSH_CONNECTION
debug3: Ignored env LESSOPEN
debug3: Ignored env LESSCLOSE
debug3: Ignored env _
debug3: Ignored env OLDPWD
debug1: Sending command: schtasks /query
debug2: channel 0: request exec confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug2: channel 0: rcvd eow
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug2: channel 0: rcvd ext data 88
ERROR: A specified logon session does not exist. It may already have been terminated.
debug2: channel 0: written 88 to efd 6
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
    #0 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cc -1)

当使用交换机启动 sshd-D并使用密钥进行身份验证时调试日志。

debug3: Ignored env SSH_CONNECTION
debug3: Ignored env LESSOPEN
debug3: Ignored env LESSCLOSE
debug3: Ignored env _
debug3: Ignored env OLDPWD
debug1: Sending command: schtasks /query
debug2: channel 0: request exec confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0

Folder: \
TaskName                                 Next Run Time          Status
======================================== ====================== ===============
test1                                 N/A                    Running

RegIdleBackup                            8/6/2018 12:25:27 AM   Ready
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug2: channel 0: rcvd eow
debug2: channel 0: close_read
debug2: channel 0: input open -> closed


Folder: \Microsoft\Windows\Wininet
TaskName                                 Next Run Time          Status
======================================== ====================== ===============
test2                                      N/A                    Running
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
    #0 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cc -1)

Transferred: sent 2712, received 13664 bytes, in 0.2 seconds
Bytes per second: sent 17373.0, received 87531.3
debug1: Exit status 0

相关内容