OS X SSH 不断要求输入密码

OS X SSH 不断要求输入密码

我使用公钥/私钥通过 ssh 从 Linux 计算机连接到多台 Mac。

每个 ac、从 10.5 到 10.9 的不同操作系统以及公钥工作的设置都是相同的。只有其中一个运行 OS X 10.9.5,不断询问用户密码而不是使用公钥。

实际上,任何机器都无法使用公钥进行访问

ssh -vvv 是:

...
debug1: Authentications that can continue: publickey,keyboard-interactive
debug3: start over, passed a different list publickey,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering DSA public key: /Users/akeeem/.ssh/id_dsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Trying private key: /Users/akeeem/.ssh/id_rsa
debug3: no such identity: /Users/akeeem/.ssh/id_rsa: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug2: we sent a keyboard-interactive packet, wait for reply
debug2: input_userauth_info_req
debug2: input_userauth_info_req: num_prompts 1
Password:

我应该检查什么来确保公钥可以运行?

答案1

您必须确保 ssh 服务器已配置为接受公钥身份验证。

然后,如果消息错误表明我们没有发送数据包,则禁用方法意味着 ssh 服务器在访问authorized_keys 文件时遇到一些问题。您应该检查:

authorized_keys 的语法是正确的。 .ssh目录和authorized_keys文件的权限正确。好的选择是使用 ssh-copy-id 将公钥文件复制到服务器,它将创建具有必要权限的所有文件和目录。

ssh-copy-id -i /home/用户名/.ssh/id_rsa.pub 用户名@服务器

相关内容