我为组设置了 SSH 服务器,使其接受使用公钥身份验证的连接myGroup
。我在这个组内的服务器上创建了一个名为 的用户myUser
。然后我在服务器上生成了密钥对,将公钥放入/home/myUser/.ssh/authorized_keys
文件夹中,重新启动sshd
,然后尝试使用此用户和我的私钥文件从远程计算机进行连接:
ssh -i /path/to/id_rsa myUser@<server_address> -vvv
身份验证成功,但连接立即断开:
...
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /tmp/testing/id_rsa
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug3: sign_and_send_pubkey: RSA 5f:8e:29:80:22:3c:c5:e9:48:42:b1:3e:57:e0:c3:f5
debug2: we sent a publickey packet, wait for reply
debug1: Authentication succeeded (publickey).
Authenticated to <server_address> ([<server_address>]:22).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Requesting [email protected]
debug1: Entering interactive session.
Write failed: Broken pipe
正如你所见,公钥认证成功了,但是我得到的却是Write failed: Broken pipe
。
我错过了什么?
答案1
事实证明,如果你Chroot
在 sftp 设置中指定了,该文件夹必须由 root 拥有,并且具有755
权限确切地。