![无法通过 SSH 登录 localhost,但身份验证成功](https://linux22.com/image/99191/%E6%97%A0%E6%B3%95%E9%80%9A%E8%BF%87%20SSH%20%E7%99%BB%E5%BD%95%20localhost%EF%BC%8C%E4%BD%86%E8%BA%AB%E4%BB%BD%E9%AA%8C%E8%AF%81%E6%88%90%E5%8A%9F.png)
当我尝试使用ssh
本地登录时,它会关闭连接。
$ ssh -vvv Chloe@localhost
...
debug2: we sent a publickey packet, wait for reply
debug1: Authentication succeeded (publickey).
Authenticated to localhost ([::1]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: send packet: type 1
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t3 r-1 i0/0 o0/0 fd 4/5 cc -1)
Connection to localhost closed by remote host.
Connection to localhost closed.
Transferred: sent 1952, received 1412 bytes, in 0.0 seconds
Bytes per second: sent 12675697.7, received 9169101.0
debug1: Exit status -1
不过本地可以登录
Chloe@xps ~
$ login
login: Chloe
Password:
Last login: Thu May 22 00:01:42 from ...
并打开终端就好了。它还正在关闭与另一台计算机的连接。我按照这个答案中的所有步骤进行操作(为什么我的 SSH 连接在 pubkey 身份验证成功后立即关闭?)但它仍然失败。
$ ls -ld ~/.ssh
drwx------+ 1 Chloe None 0 Jul 5 2014 /home/Chloe/.ssh
所有文件均为 600,组无。
$ ls -l .ssh
total 55
-rw------- 1 Chloe None 395 May 21 2014 authorized_keys
-rw------- 1 Chloe None 1638 Apr 6 2009 authorized_keys.old
-rw------- 1 Chloe None 668 Apr 6 2009 id_dsa
-rw------- 1 Chloe None 603 Apr 6 2009 id_dsa.pub
-rw------- 1 Chloe None 1675 Apr 6 2009 id_rsa
...
sshd
作为 Cygwin 服务运行。
$ cygrunsrv -Q sshd
Service : sshd
Display name : CYGWIN sshd
Current State : Running
Controls Accepted : Stop
Command : /usr/sbin/sshd -D
启用公钥认证和回收服务器。
$ grep Pubkey /etc/sshd_config
PubkeyAuthentication yes
服务器日志为空。
$ ls -l /var/log/sshd.log
-rw-r--r--+ 1 cyg_server None 0 Nov 21 22:55 /var/log/sshd.log
赛格温 2.5.2、Windows 8.1