use*_*412 34 linux ssh daemon authentication keys
我不知道这是如何发生的。发行版是 Scientific Linux 6.1,一切都设置为通过公钥执行身份验证。然而,当 sshd 作为守护进程运行时(service sshd start),它不接受公钥。(为了获取这段日志,我已经更改了 sshd 脚本以添加 -ddd 选项)
debug1: trying public key file /root/.ssh/authorized_keys
debug1: restore_uid: 0/0
debug1: temporarily_use_uid: 0/0 (e=0/0)
debug1: trying public key file /root/.ssh/authorized_keys2
debug1: restore_uid: 0/0
Failed publickey for root from xxx.xxx.xxx.xxx port xxxxx ssh2
debug3: mm_answer_keyallowed: key 0x7f266e1a8840 is not allowed
debug3: mm_request_send entering: type 22
debug3: mm_request_receive entering
debug2: userauth_pubkey: authenticated 0 pkalg ssh-rsa
debug3: Wrote 64 bytes for a total of 1853
debug1: userauth-request for user root service ssh-connection method publickey
debug1: attempt 2 failures 1
Run Code Online (Sandbox Code Playgroud)
如果 sshd 在调试模式下运行/usr/sbin/sshd -ddd,身份验证就像一个魅力:
debug1: trying public key file /root/.ssh/authorized_keys
debug1: fd 4 clearing O_NONBLOCK
debug1: matching key found: file /root/.ssh/authorized_keys, line 1
Found matching RSA key: d7:3a:08:39:f7:28:dc:ea:f3:71:7c:23:92:02:02:d8
debug1: restore_uid: 0/0
debug3: mm_answer_keyallowed: key 0x7f85527ef230 is allowed
debug3: mm_request_send entering: type 22
debug3: mm_request_receive entering
debug3: Wrote 320 bytes for a total of 2109
debug2: userauth_pubkey: authenticated 0 pkalg ssh-rsa
Postponed publickey for root from xxx.xxx.xxx.xxx port xxxxx ssh2
debug1: userauth-request for user root service ssh-connection method publickey
debug1: attempt 2 failures 0
Run Code Online (Sandbox Code Playgroud)
有任何想法吗??有没有人见过这样的事情?
笔记:
已仔细检查文件权限:
# ll -d .ssh
drwx------. 2 root root 4096 Oct 14 10:05 .ssh
# ll .ssh
total 16
-rw-------. 1 root root 786 Oct 14 09:35 authorized_keys
-rw-------. 1 root root 1675 Oct 13 08:24 id_rsa
-rw-r--r--. 1 root root 393 Oct 13 08:24 id_rsa.pub
-rw-r--r--. 1 root root 448 Oct 13 12:51 known_hosts
Run Code Online (Sandbox Code Playgroud)
有人问我 sshd 是否可以在“守护进程模式”下访问 root 的文件。我对这个问题最接近的答案是:
# netstat -ntap | grep 22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 19847/sshd
# ps -ef | grep 19847
root 19847 1 0 09:58 ? 00:00:00 /usr/sbin/sshd
Run Code Online (Sandbox Code Playgroud)
如果 sshd 以 root 身份运行,我不知道如何无法访问它自己的文件。SELinux 可能是原因吗?
Mar*_*ner 44
是的,SELinux 可能是原因。该.ssh目录可能标记错误。看看/var/log/audit/audit.log。它应该被标记ssh_home_t。与ls -laZ. restorecon -r -vv /root/.ssh如果需要,请运行。
| 归档时间: |
|
| 查看次数: |
74341 次 |
| 最近记录: |