我有两个服务器,标识为 server-1 - 192.168.3.128
和 server-2 - 192.168.3.130
。我正在设置 capifony
以自动部署从 server-1 到 server-2,这是我到目前为止所做的:
- 在两台服务器中,我都创建了一个没有密码的用户
deploy
,因为我将使用该用户进行部署。 - 在 server-1 中,我通过运行以下命令设置了 SSH key :
ssh-keygen
并且没有密码短语和默认目录。 - 我已将 server-1 的
/home/deploy/.ssh/id_rsa.pub
的内容复制到 server-2 的/home/deploy/.ssh/authorized_keys
。 我尝试从服务器 1 通过运行
ssh deploy@192.168.3.130
访问服务器 2,它要求输入密码(下面是输出)$ ssh deploy@192.168.3.130 The authenticity of host '192.168.3.130 (192.168.3.130)' can't be established. RSA key fingerprint is 3c:81:da:7a:78:0f:b0:2f:44:3b:62:fb:c9:6f:33:86. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.3.130' (RSA) to the list of known hosts. deploy@192.168.3.130's password:
这是上面命令的 -v
输出:
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 192.168.3.130 [192.168.3.130] port 22.
debug1: Connection established.
debug1: identity file /home/deploy/.ssh/identity type -1
debug1: identity file /home/deploy/.ssh/identity-cert type -1
debug1: identity file /home/deploy/.ssh/id_rsa type 1
debug1: identity file /home/deploy/.ssh/id_rsa-cert type -1
debug1: identity file /home/deploy/.ssh/id_dsa type -1
debug1: identity file /home/deploy/.ssh/id_dsa-cert type -1
debug1: identity file /home/deploy/.ssh/id_ecdsa type -1
debug1: identity file /home/deploy/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
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 '192.168.3.130' is known and matches the RSA host key.
debug1: Found key in /home/deploy/.ssh/known_hosts:1
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,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
Cannot determine realm for numeric host address
debug1: Unspecified GSS failure. Minor code may provide more information
Cannot determine realm for numeric host address
debug1: Unspecified GSS failure. Minor code may provide more information
debug1: Unspecified GSS failure. Minor code may provide more information
Cannot determine realm for numeric host address
debug1: Next authentication method: publickey
debug1: Trying private key: /home/deploy/.ssh/identity
debug1: Offering public key: /home/deploy/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/deploy/.ssh/id_dsa
debug1: Trying private key: /home/deploy/.ssh/id_ecdsa
debug1: Next authentication method: password
deploy@192.168.3.130's password:
为什么?我做错了什么?
最佳答案
除了在详细模式下运行客户端之外,在另一个端口上以 Debug模式启动一个新的服务器实例:
server-2 作为根:
# /usr/sbin/sshd -p 9999 -d
然后以详细模式连接到同一端口上的该服务器:
server-1 作为部署
$ ssh -vvv -p 9999 server-2
9/10 与权限有关。
关于linux - 服务器之间的 SSH 登录仍然要求输入密码,为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33490950/