Freebsd ssh 密钥不起作用

Freebsd ssh 密钥不起作用

我在 freebsd vps 上使用 ssh 密钥时遇到问题。我生成了一个密钥,它在 debian 上有效。我通常只需将其复制粘贴到,~/.ssh/authorized_keys它就可以开始工作。在 freebsd 中却不行。我尝试将其输入,但~/.ssh/authorized_keys2仍然没有响铃。我的密钥有密码。所以当我登录 osx 密码窗口弹出窗口输入密码时,我按下确定后它显示ident added to id_rsa,然后 ssh 仍然在 shell 中要求输入密码。

我的笔记本电脑是 osx lion。可以运行的服务器是 debian 6 squeeze 服务器,无法运行 freebsd8.2

更新:

ssh 详细输出:

Romans-MacBook-Pro:~ holms$ ssh -v [email protected]
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to xxx.nl [xx.xx.xx.xx] port 22.
debug1: Connection established.
debug1: identity file /Users/holms/.ssh/id_rsa type -1
debug1: identity file /Users/holms/.ssh/id_rsa-cert type -1
debug1: identity file /Users/holms/.ssh/id_dsa type -1
debug1: identity file /Users/holms/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.4p1 FreeBSD-20100308
debug1: match: OpenSSH_5.4p1 FreeBSD-20100308 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) 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 'roman.travelbird.nl' is known and matches the RSA host key.
debug1: Found key in /Users/holms/.ssh/known_hosts:3
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/holms/.ssh/id_rsa
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Trying private key: /Users/holms/.ssh/id_rsa
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
debug1: read PEM private key done: type RSA
Identity added: /Users/holms/.ssh/id_rsa (/Users/holms/.ssh/id_rsa)
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey,keyboard-interactive
debug1: Trying private key: /Users/holms/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
Password:
debug1: Authentication succeeded (keyboard-interactive).
Authenticated to roman.travelbird.nl ([94.23.147.31]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
Last login: Fri Jan 27 16:11:33 2012 from 46.145.76.30
Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994
    The Regents of the University of California.  All rights reserved.

FreeBSD 8.2-RELEASE (GENERIC) #0: Thu Feb 17 02:41:51 UTC 2011


 (                                     (    (    
 )\ )                                  )\ ) )\ ) 
(()/(         )       )        (   (  (()/((()/( 
 /(_)) (     (     ( /(   (    )\  )\  /(_))/(_))
(_))   )\    )\  ' )(_))  )\ )((_)((_)(_)) (_))  
| _ \ ((_) _((_)) ((_)_  _(_/(\ \ / / | _ \/ __| 
|   // _ \| '  \()/ _` || ' \))\ V /  |  _/\__ \ 
|_|_\\___/|_|_|_| \__,_||_||_|  \_/   |_|  |___/ 


$ 

答案1

问题解决了:

看来当我复制公钥时,每个空格后面都以某种方式添加了空格。当我删除它们时,一切正常。感谢 natxo_asenjo 提供的提示

相关内容