Can't connect to my SSH server

Hello all!
I’m trying to make a small home server but I have problems setting up an SSH server.
On the server I use ubuntu-server on the client-side it is Manjaro. I want to be able to connect only with keys and not with passwords!

Now when I try connecting to the localhost on the server it works just fine, but after copying the generated public key to my Manjaro machine and trying to connect it just throws “Permission denied (Public key)”

After looking around the internet I found that by using -v I can find out more, so I’ll be sharing it’s contents

OpenSSH_8.4p1, OpenSSL 1.1.1h  22 Sep 2020
debug1: Reading configuration data /home/gramms/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 192.168.1.100 [192.168.1.100] port 6999.
debug1: Connection established.
debug1: identity file /home/gramms/.ssh/id_rsa type 0
debug1: identity file /home/gramms/.ssh/id_rsa-cert type -1
debug1: identity file /home/gramms/.ssh/id_dsa type -1
debug1: identity file /home/gramms/.ssh/id_dsa-cert type -1
debug1: identity file /home/gramms/.ssh/id_ecdsa type -1
debug1: identity file /home/gramms/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/gramms/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/gramms/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/gramms/.ssh/id_ed25519 type -1
debug1: identity file /home/gramms/.ssh/id_ed25519-cert type -1
debug1: identity file /home/gramms/.ssh/id_ed25519_sk type -1
debug1: identity file /home/gramms/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/gramms/.ssh/id_xmss type -1
debug1: identity file /home/gramms/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.1
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.1.100:6999 as 'gramms'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 CENSORING KEY
debug1: Host '[192.168.1.100]:6999' is known and matches the ECDSA host key.
debug1: Found key in /home/gramms/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /home/gramms/.ssh/id_rsa RSA CENSORING KEY
debug1: Will attempt key: /home/gramms/.ssh/id_dsa 
debug1: Will attempt key: /home/gramms/.ssh/id_ecdsa 
debug1: Will attempt key: /home/gramms/.ssh/id_ecdsa_sk 
debug1: Will attempt key: /home/gramms/.ssh/id_ed25519 
debug1: Will attempt key: /home/gramms/.ssh/id_ed25519_sk 
debug1: Will attempt key: /home/gramms/.ssh/id_xmss 
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/gramms/.ssh/id_rsa RSA CENSORING KEY
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/gramms/.ssh/id_dsa
debug1: Trying private key: /home/gramms/.ssh/id_ecdsa
debug1: Trying private key: /home/gramms/.ssh/id_ecdsa_sk
debug1: Trying private key: /home/gramms/.ssh/id_ed25519
debug1: Trying private key: /home/gramms/.ssh/id_ed25519_sk
debug1: Trying private key: /home/gramms/.ssh/id_xmss
debug1: No more authentication methods to try.
gramms@192.168.1.100: Permission denied (publickey).

Any help on how could I resolve this would be much appreciated!

On Ubuntu machine:

(ubuntu) $ cat ~/.ssh/id_rsa.pub

… and check if this key exists in Manjaro authorized keys:

(manjaro) $ cat ~/.ssh/authorized_keys
1 Like

it does. If I’m correct, the ssh-copy-id puts it there.

They are my notes on the steps I took to secure public SSH instances on VPS I had some fun with.