编辑
此处暴露的问题已解决(关于文件
.ssh
夹的文件模式。但另一个问题仍然存在,所以我创建了一个新问题:>无法使用 SSH-RSA 密钥登录
我无法再连接特定用户的 ssh-rsa 密钥,但它仍然适用于其他用户。
该git
定义如下用户:
# cat /etc/passwd | grep git
git:x:1002:1002:,,,:/var/git:/bin/bash
Run Code Online (Sandbox Code Playgroud)
所以你注意到这是 git 用户,因此它的家是/var/git
,它不在/home
.
现在,ssh 总是提示我输入密码:
$ ssh git@srv
git@srv's password:
Run Code Online (Sandbox Code Playgroud)
我检查了日志:
# tail -n 1 /var/log/auth.log
[...] Authentication refused: bad ownership or modes for file /var/git/.ssh/authorized_keys
Run Code Online (Sandbox Code Playgroud)
因此authorized_keys
,某些所有权或模式配置错误。我不明白,因为这里是这个文件的 conf :
# ls -l /var/git/.ssh/ | grep auth
-rw-rw-r-- 1 git git 394 mai 22 17:39 authorized_keys
Run Code Online (Sandbox Code Playgroud)
这是(以防……)父.ssh
目录:
# ls -al /var/git/ | …
Run Code Online (Sandbox Code Playgroud) 注意:这适用于 Centos 7。如果您正在寻找 Debian 的答案,请参阅此问题。这些答案不会在这里重复。
安装 centos 7 后,我无法访问手册页:
# man ls
-bash: man: command not found
Run Code Online (Sandbox Code Playgroud)
我尝试通过 yum 安装它
# yum install man-pages
... ok
Run Code Online (Sandbox Code Playgroud)
但是再次:
# man ls
-bash: man: command not found
Run Code Online (Sandbox Code Playgroud)
为什么?
这篇文章是在这个问题之后:身份验证被拒绝:文件 /var/git/.ssh/authorized_keys 的所有权或模式错误。
在那里暴露的问题已解决(关于文件
.ssh
夹的文件模式。但是另一个问题仍然存在,所以我创建了一个新问题:
当我尝试登录(使用详细选项)时,一切似乎都运行良好,但最后,发生了以下情况:
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/remi/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/remi/.ssh/id_dsa
debug1: Trying private key: /home/remi/.ssh/id_ecdsa
debug1: Trying private key: /home/remi/.ssh/id_ed25519
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
Run Code Online (Sandbox Code Playgroud)
我不明白,因为这些行对我来说似乎毫无意义:
we sent a publickey packet, wait for reply …