unable to connect via ssh to remote server

Hello,
I am using openSUSE Leap 42.2, with KDE Desktop.
I have just started a new server with Digital Ocean, which has my public key to connect via ssh. However, I cannot connect. I have copied the .pub file content to the used keys, using the supplier’s manager. After the command ssh root@my-number-of-ip, the result is: Permission denied (publickey).
I have connected other times with the same procedure, using Ubuntu and Debian. Shall I activate or deactivate something in the firewall? It is settled as default desktop options.

My .pub file has 644 permissions, and it is settled in my /home/user-name/.ssh/ and the private file has 600.

Maybe copying from the terminal can have hidden characteres or errors because of the different lines?

Thanks.

Turn up debugging by adding ‘-vvv’ to the SSH command and post the output
as that will often help get close to the problem.


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…

When I do ssh -vvv I can get this information, in the last part. I preffer not to include ip informations and so:

Found key in /home/jose/.ssh/known_hosts:4
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug2: key: /home/jose/.ssh/id_rsa ((nil))
debug2: key: /home/jose/.ssh/id_dsa ((nil))
debug2: key: /home/jose/.ssh/id_ecdsa ((nil))
debug2: key: /home/jose/.ssh/id_ed25519 ((nil))
debug3: send packet: type 5
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/jose/.ssh/id_rsa
debug3: no such identity: /home/jose/.ssh/id_rsa: No such file or directory
debug1: Trying private key: /home/jose/.ssh/id_dsa
debug3: no such identity: /home/jose/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/jose/.ssh/id_ecdsa
debug3: no such identity: /home/jose/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/jose/.ssh/id_ed25519
debug3: no such identity: /home/jose/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).

Perhaps the public and private files must be named as id_rsa?? I named them with a different name, invented by me… In other Linux systems, it works!

No they don’t unless you use ssh -i ~/.ssh/yourcoolprivatekey username@host

Otherwise it has to be named id_rsa or .ssh/config needs to define the host/user/key.

Thanks a lot! That was the reason.

I have been used ssh in Debian and Ubuntu desktops for long, and I never had to indicate ssh -i my-file. Anyway, I’ll do it from now on.