ssh-copy-id no identities found error

后端 未结 13 1149
情深已故
情深已故 2021-01-31 01:21

I have few client systems where I need to push the ssh key and login from my server without authentication prompts.

First, on the server, I created ssh key as below whi

相关标签:
13条回答
  • 2021-01-31 01:28

    You need to use the -i flag:

    ssh-copy-id -i my.key.pub 10.10.1.1
    

    From the man page:

    If the -i option is given then the identity file (defaults to ~/.ssh/id_rsa.pub) is used, regardless of whether there are any keys in your ssh-agent. Otherwise, if this: ssh-add -L provides any output, it uses that in preference to the identity file

    0 讨论(0)
  • 2021-01-31 01:31

    In my case it was the missing .pub extension of a key. I pasted it from clipboard and saved as mykey. The following command returned described error:

    ssh-copy-id -i mykey localhost
    

    After renaming it with mv mykey mykey.pub, works correctly.

    ssh-copy-id -i mykey.pub localhost
    
    0 讨论(0)
  • 2021-01-31 01:36

    The ssh-copy-id is not able to locate the id_rsa.pub file that is generated by ssh-keygen in your system, Use the following command to complete:

    1. find the path of the .pub file: locate *.pub
    2. copy the path (ex: /home/user_name/.ssh/id_rsa.pub) and run the following command: ssh-copy-id -i /home/user_name/.ssh/id_rsa.pub hostname
    0 讨论(0)
  • 2021-01-31 01:38

    Generating ssh keys on the client solved it for me

    $ ssh-keygen -t rsa
    
    0 讨论(0)
  • 2021-01-31 01:40

    The simplest way is to:

    ssh-keygen
    [enter]
    [enter]
    [enter]
    
    cd ~/.ssh
    ssh-copy-id -i id_rsa.pub USERNAME@SERVERTARGET
    

    Att:

    Its very very simple.

    In manual of "ss-keygen" explains:

    "DESCRIPTION ssh-keygen generates, manages and converts authentication keys for ssh(1). ssh-keygen can create RSA keys for use by SSH protocol version 1 and DSA, ECDSA or RSA keys for use by SSH protocol version 2. The type of key to be generated is specified with the -t option. If invoked without any arguments, ssh-keygen will generate an RSA key for use in SSH protocol 2 connections."

    0 讨论(0)
  • 2021-01-31 01:43

    Use simple ssh-keyscan hostname to find if key(s) exists on both sites:

    ssh-keyscan rc1.localdomain
    [or@rc2 ~]$ ssh-keyscan rc1
    # rc1 SSH-2.0-OpenSSH_5.3
    rc1 ssh-rsa AAAAB3NzaC1yc2EAAAABI.......==
    
    ssh-keyscan rc2.localdomain
    [or@rc2 ~]$ ssh-keyscan rc2
    # rac2 SSH-2.0-OpenSSH_5.3
    rac2 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAys7kG6pNiC.......==
    
    0 讨论(0)
提交回复
热议问题