SSH without password with non-default identity file location
It fails for the same reason that ssh-copy-id
failed the first time - i.e. because you have chosen a non-default location for the identity file.
You can resolve it in the same way, by adding -i /home/user/ssh/keys/server1key
to your ssh
command - note that the client side needs the location of the private key file.
From man ssh
-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,
~/.ssh/id_ed25519 and ~/.ssh/id_rsa for protocol version 2.
Alternatively, you may wish to create a ~/.ssh/config
file entry for the host along the lines of
Host somename
Hostname 192.168.1.3
User user
IdentityFile /home/user/ssh/keys/server1key
Another reason that ssh-copy-id
fails is that the key hasn't been added to the SSH agent.
First, check and start if ssh-agent
is running:
eval "$(ssh-agent -s)"
If you get in process ID, you can add your key:
ssh-add -k /home/user/ssh/keys/server1key
With -k
you add the key to the keychain.
Check if keys are added with:
ssh-add -l
ssh-copy-id
should be working now.