I'm following this tutorial and this is what I'm trying
ssh-copy-id -i ~/.ssh/id_rsa.pub remote_hostIt says Permission denied (publickey,password).
I've also tried ssh -v remote_host and verified that
debug1: Reading configuration data /Users/praful/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to remote_host port 22.
debug1: Connection established.
debug1: identity file /Users/praful/.ssh/id_rsa type 1
debug1: identity file /Users/praful/.ssh/id_rsa-cert type -1
debug1: identity file /Users/praful/.ssh/id_dsa type -1
debug1: identity file /Users/praful/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.1 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr none
debug1: kex: client->server aes128-ctr none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<2048<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: Server host key: RSA 55:60:e4:78:c8:98:09:d2:0f:d3:69:73:b9:e0:99:60
debug1: Host is known and matches the RSA host key.
debug1: Found key in /Users/praful/.ssh/known_hosts:63
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,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/praful/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /Users/praful/.ssh/id_dsa
debug1: Next authentication method: password
root@remote_host's password: 7 1 Answer
You should give the private key to ssh-copy-id or no key at all as mentioned in the synopsis of the command (from manual page):
ssh-copy-id [...] [-i [identity_file]] [-p port] [-o ssh_option] [user@]hostnameor no key at all (it will copy all the keys in standard location in that case). Using the following should do the job:
ssh-copy-id -i ~/.ssh/id_rsa remote_hostIf it will not be helpful, please run
ssh-copy-id -i ~/.ssh/id_rsa -o LogLevel=DEBUG3 remote_hostand update the question with the output to investigate more.