我在 cygwin 的帮助下安装了 openssh 作为服务本教程
我可以从 cygwin ssh 进入 localhost。
但是,当我尝试从 putty 执行此操作时,出现“服务器拒绝我们的密钥”错误。
在设置过程中,id_rsa
和id_rsa.pub
在 .ssh 文件夹中生成。
我获取id_rsa
文件,将其导入 puttygen 并生成private.ppk
文件。
我在 putty 中创建了一个会话来使用私钥。
当我尝试登录时,系统提示我输入用户名。输入用户名后,系统出现“拒绝我们的密钥”错误,并尝试使用密码验证。
我将不胜感激任何帮助。
编辑:
如果有帮助的话,以下是从 cygwin 成功通过 SSH 连接到 localhost 的输出
$ ssh -v localhost
OpenSSH_6.0p1, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to localhost [::1] port 22.
debug1: Connection established.
debug1: identity file /home/Pasha/.ssh/id_rsa type 1
debug1: identity file /home/Pasha/.ssh/id_rsa-cert type -1
debug1: identity file /home/Pasha/.ssh/id_dsa type -1
debug1: identity file /home/Pasha/.ssh/id_dsa-cert type -1
debug1: identity file /home/Pasha/.ssh/id_ecdsa type -1
debug1: identity file /home/Pasha/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0
debug1: match: OpenSSH_6.0 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0
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: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 7a:52:.........
debug1: Host 'localhost' is known and matches the ECDSA host key.
debug1: Found key in /home/Pasha/.ssh/known_hosts:1
debug1: ssh_ecdsa_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,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/Pasha/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
Authenticated to localhost ([::1]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
Last login: Tue Jul 17 00:14:52 2012 from ::1
答案1
该程序为您当前登录的用户ssh-user-config
生成一个 SSH 密钥对(~/.ssh/id_rsa
和),并且如果您愿意,还将其添加到,其中可能指的是或。~/.ssh/id_rsa.pub
~/.ssh/authorized_keys
~
/cygdrive/c/cygwin/home
C:\cygwin\home
因此,您需要以运行时的同一用户身份登录ssh-user-config
。(这是两者都不 cyg_server
也不是sshd
,它们是用于 SSH 登录过程的特殊账户。)