What the Message Means
The word in brackets lists the login methods the server still allows. (publickey) means passwords are off and your keys did not work. Check the causes below in order; most cases end at the first or second.
1. Wrong User Name
A key is accepted per account. If you added it for deploy but connect as another user, the server rejects it. Cloud images often create a default user other than root; your provider's control panel shows which one. Name the user explicitly:
ssh user@your_server_ip2. The Key Is Not Offered
Watch what the client does:
ssh -v user@your_server_ipLook for lines that say which public keys are offered and whether the server accepted any. If your key is not in the list, name it:
ssh -i ~/.ssh/id_ed25519 -o IdentitiesOnly=yes user@your_server_ipIdentitiesOnly=yes stops the agent from trying all its other keys first. Without it, a full agent can use up the server's attempt limit and the connection ends with "Too many authentication failures". Make it permanent in the SSH config file.
3. The Public Key Is Not on the Server
Log in through the provider's console and check:
cat /home/user/.ssh/authorized_keysCompare the line with cat ~/.ssh/id_ on your computer. It must be one unbroken line. If the server reads keys from another place, sudo sshd -T | grep -i authorizedkeysfile shows the path. Add a missing key as described in ssh-copy-id.
4. Permissions or Ownership
sshd ignores authorized_ if the home folder, ~/.ssh, or the file can be changed by other users, or if they belong to someone else. Fix all three:
sudo chmod go-w /home/user
sudo chmod 700 /home/user/.ssh
sudo chmod 600 /home/user/.ssh/authorized_keys
sudo chown -R user:user /home/user/.sshOn AlmaLinux and Rocky Linux, a file copied into place can carry the wrong SELinux label. Restore it:
sudo restorecon -Rv /home/user/.sshSee chown recursive for ownership in more depth.
5. Key Type Refused
Current OpenSSH servers reject DSA keys, and since OpenSSH 8.8 they no longer accept RSA signatures that use SHA-1 by default. An RSA key still works with a current client, but a DSA key, or a client too old to sign with SHA-2, can fail for that reason alone. Create a new Ed25519 key with ssh-keygen and install it.
6. A User Filter in the Configuration
The options AllowUsers, AllowGroups, DenyUsers, and DenyGroups limit who may log in at all. If one is set, your user must match it:
sudo sshd -T | grep -Ei 'allowusers|allowgroups|denyusers|denygroups'Read the Server Log
The server usually states the exact reason. In the console, run
sudo journalctl -u ssh -n 50 # Ubuntu, Debian
sudo journalctl -u sshd -n 50 # AlmaLinux, Rocky LinuxOn systems that also write text logs, the same lines are in /var/log/auth.log (Ubuntu, and Debian with rsyslog installed) or /var/log/secure (AlmaLinux, Rocky Linux). Since Debian 12, rsyslog is not installed by default, so on a new Debian server the journal is the only log. Follow them live while you retry with tail -f; look for messages about bad ownership or modes, or a user not allowed.
Updated:
Linux VPS with Full Root Access
MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.
More Guides
No Limits on Service or Support
You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

- 100% customer satisfaction goal
- Our own hardware
- 24/7 ticket and email support
- 4 countries with locations