I'm trying to connect to my home server with public key authentication, but it is failing. I have connected this way for a long time without any problem, and now it's failing, but I don't know why.
The majority of documentation I' reading in internet tells me to use ssh-keygen
and ssh-copy-id
and other commands like these. I'm not doing this, because I have this same key in several hosts, and it would be complicated for me to change the key everywhere - this is why I'm asking for help. I use instead a pair key generated with PuTTy in a Windows host, and the private key is password protected.
Now I'll explain my case.
Today, I have done clean-reinstall in this server which is giving me problems, in order to simplify my case and make it simpler for you guys helping me. I have installed Ubuntu 18.04.5 and then sudo apt dist-upgrade
to Ubuntu 18.04.6. In the live server installer I set manually the network parameters (everything works fine) and I set it to install OpenSSH server. The server is in 192.168.1.16/24 in my local network. I have also set up zfsutils-linux and imported a ZFS pool I used in my previous installations.
Now, I connected from my Windows host with PuTTy using password authentication. I then copied my public key from puttygen (the area that says public key for pasting into OpenSSH authorized_keys file:), to an empty file under ~/.ssh/
and saved it to authorized_keys
. The command is as follows:
alex@freenalex:~/.ssh$ sudo nano authorized_keys
I have always done this way with no problem. Now I checked and fixed ownership and permissions, which are as the following code:
alex@freenalex:~/.ssh$ ls -al
total 12
drwx------ 2 alex alex 4096 Jan 11 12:58 .
drwxr-xr-x 5 alex alex 4096 Jan 11 12:12 ..
-rw------- 1 alex alex 398 Jan 11 12:11 authorized_keys
Now I setup PuTTy to connect with the private key, but it shows this:
login as: alex
Server refused our key
[email protected]'s password:
I have this public key in other servers as well, and I tried today some connection examples, for example from ubuntu desktop virtual machine to the same server (I think other tries made error, but now succesfully), and from this windows machine with PuTTy to another server in my local network, with same key pair for the same user alex (sucessfully)
Maybe I have a virus? it's so strange.
I can provide more information if you ask.
Thanks in advance.