ssh不首先从用户配置文件读取,而是从系统范围配置读取。
这是我的ssh详细跟踪(使用本地用户,而不是root):
-bash-4.1$ ssh -v srg-b@github.com
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 github.com [192.30.253.113] port 22.
debug1: Connection established.
debug1: identity file /var/www/html/.ssh/identity type -1
debug1: identity file /var/www/html/.ssh/identity-cert type -1
debug1: identity file /var/www/html/.ssh/id_rsa type -1
debug1: identity file /var/www/html/.ssh/id_rsa-cert type -1
debug1: identity file /var/www/html/.ssh/id_dsa type -1
debug1: identity file /var/www/html/.ssh/id_dsa-cert type -1
debug1: identity file /var/www/html/.ssh/id_ecdsa type -1
debug1: identity file /var/www/html/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
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-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
The authenticity of host 'github.com (192.30.253.113)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.253.113' (RSA) to the list of known hosts.
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
debug1: Next authentication method: publickey
debug1: Trying private key: /var/www/html/.ssh/identity
debug1: Trying private key: /var/www/html/.ssh/id_rsa
debug1: Trying private key: /var/www/html/.ssh/id_dsa
debug1: Trying private key: /var/www/html/.ssh/id_ecdsa
debug1: No more authentication methods to try.
Permission denied (publickey).
因此,它无法找到我的密钥,其位置在本地配置中指定。为什么ssh忽略本地配置文件,位于~/.ssh/config?该文件具有rwe规则600。我也尝试过mod 400,但无济于事。
它可能是来自Apache或nginx安装的www-data用户。
—
LawrenceC
~/.ssh/config,但告诉我们完整的路径?是吗/var/www/html/.ssh/config,因为这似乎是SSH正在寻找的路径。什么帐户用于ssh?