I am having problems with my newly setup Ubuntu 22.04 LTS server.
My goal is to access the server via SSH from my laptop. But I cannot connect and get an "Permission denied" error after inserting my password.
What I did so far:
- installing Ubuntu 22.04 with OpenSSH
- setting up the ssh config (/etc/ssh/sshd_config)
- PubkeyAuthentication yes - PasswordAuthentication yes
- AllowUsers MyUsername
- restarted the ssh server
When I now try to connect via "ssh MyUsername@MyServer" from the local network, I get the permission denied error. I am trying to connect from my MacBook Pro (M3 Pro).
When I use a windows machine instead I can easily access my server with powershell. So I don't think that the server is the actual problem. Only from my Mac it does not work.
I already tried to generate a key on my MacBook to use the pub key instead of the password. So I generated the key with ssh-keygen and then copied the public key to the server (I did this with my windows laptop since I cannot connect from the Mac to copy it to the server). For this I just added the pub key as a new line in ~/.ssh/authorized_keys. But this does not change anything. The password is still required and I still get the error.