i recently wanted to use ssh-keys instead of passwords for my server (Debian stretch). I am using an ubuntu subsystem on Windows (in case it matters).
I was following the top answer from this thread: Easiest way to copy ssh keys to another machine?
I did the following:
- Created a key with
ssh-keygen
and saved them at.ssh/xxx.pub
ssh-copy-id -i .ssh/xxx.pub user@server.tld
After this step I got the following message:
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/xxx.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@tserver.tld's password:
Number of key(s) added: 1
I even checked on the server under ~/.ssh/authorized_keys
there is the key.
But still when I try to connect to the server via:
ssh root@server.tld
I have to login with password.
Has someone an idea why this does not work?
~/.ssh/id_rsa
. (There are other "default" filenames, depending on the algorithm used, butid_rsa
is very common.) What's your key's filename? – PerlDuck May 29 '18 at 11:21You can add a config file in ~/.ssh/config and do
host * IdentityFile ~/.ssh/mykey
thanks tho
– nTro314 May 29 '18 at 14:59.ssh/config
would have been my next suggestion but I wonder whyidentity.pub
isn't found automatically. It's one of the default files. Although it's more "ssh-v1"-ey (I guess). – PerlDuck May 29 '18 at 15:03