Ell*_*e H 4 ssh authentication public-key
在两台机器之间设置 ssh 密钥时,身份验证只能以一种方式工作。尝试连接时,一台服务器不接受另一台服务器的公钥。有任何想法吗?这是详细的输出。
debug1: Reading configuration data /usr/local/etc/ssh_config
debug1: Rhosts Authentication disabled, originating port will not be trusted.
debug1: Connecting to xxxxxx.com [xx.xx.xx.xx] port 22.
debug1: Connection established.
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type 1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5
debug1: match: OpenSSH_5.1p1 Debian-5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.6.1p2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'xxxxxx.com' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:17
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/identity
debug1: Offering public key: /root/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Next authentication method: password
Run Code Online (Sandbox Code Playgroud)
编辑:如果重要的话,这是为了root
我刚刚遇到过 SELinux 阻止 sshd 读取 /root/.ssh/authorized_keys 文件的情况。/var/log/messages 将显示 sshd 进程被拒绝访问对 authorized_keys 文件的读取操作。
在我运行之后restorecon -v /root/.ssh/authorized_keys,使用公钥的 SSH 工作正常。
小智 6
将 StrictModes 更改为“no”/etc/ssh/sshd_config对我有用。
sysadmin@suselinux1:~> con sysadmin kaiser
Welcome to Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-25-generic i686)
* Documentation: https://help.ubuntu.com/
Last login: Fri Nov 9 15:40:11 2012 from 10.1.3.25
sysadmin@kaiser:~$ date
vie nov 9 17:53:11 CST 2012
sysadmin@kaiser:~$
Run Code Online (Sandbox Code Playgroud)
小智 5
检查 .ssh 文件夹、authorized_key 文件和主文件夹的权限和所有者,当您尝试登录时,/var/log/auth.log 会给您更多消息。
小智 2
检查 ssh 服务器上以下选项的值:
PubkeyAuthentication Yes
RSAAuthentication Yes
PermitRootLogin Yes
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
39271 次 |
| 最近记录: |