命名是否在ssh键中很重要

时间:2014-03-13 05:58:53

标签: linux ssh bitbucket ssh-keys

我正在尝试使用bitbucket克隆来自ssh keys的回购。

我使用ssh-keygen -t rsa生成了密钥,我使用的名称是abcabc.pub

我无法连接然后我尝试调试 ssh -v git@bitbucket.org

debug1: Roaming not allowed by server
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: /home/vagrant/.ssh/id_rsa
debug1: Trying private key: /home/vagrant/.ssh/id_dsa
debug1: Trying private key: /home/vagrant/.ssh/id_ecdsa
debug1: Trying private key: /home/vagrant/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
vagrant@vagrant-ubuntu-trusty-64:~$ cd ~/.ssh

因此,我发现ssh只搜索名为id_rsa

的密钥

是正确的。

我记得我的家用电脑上有一些其他的关键名称,系统能够检测到它。

我将abc重命名为id_rsa并且有效

1 个答案:

答案 0 :(得分:2)

尝试

ssh -v git@bitbucket.org -i /path/to/abc

Man Page说

-i identity_file  Selects a file from which the identity (private key) for public 
key authentication is read. The default is ~/.ssh/identity for protocol version 1,             
 and ~/.ssh/id_dsa, ~/.ssh/id_ecdsa and ~/.ssh/id_rsa for protocol version 2. 
Identity files may also be specified on a per-host basis in the configuration 
file. It is possible to have multiple -i options (and multiple identities 
specified in configuration files).  ssh will also try to load certificate 
information from the filename obtained by appending -cert.pub to identity 
filenames.