代码之家  ›  专栏  ›  技术社区  ›  user1994660

ssh密钥中的命名是否重要

  •  1
  • user1994660  · 技术社区  · 11 年前

    我正在尝试从克隆回购 bitbucket 使用 ssh keys .

    我用 ssh-keygen -t rsa 我用的名字是 abc abc.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 回复  |  直到 11 年前
        1
  •  2
  •   clement    11 年前

    尝试

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

    手册页显示

    -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.