

This key pair is used by the remote host to identify the user’s machine while connecting via SSH. The public key generated at the localhost should be added to the remote host for any new users created on the server. ssh/authorized_keys file is 600, because it’s the file where public key is stored. Most importantly, we ensure that the permission of the. ssh folder and the files in this folder.Īnd, if any permission or ownership related errors are noted, we correct them immediately.


So, our Hosting Engineers first check the permission and ownership of the. ssh folder should be 700 and the files in. In both cases, the DigitalOcean server shows Permission denied (publickey). Similarly, there are cases in which users don’t have sufficient permission or ownership to read the private and public key. ssh folder can be written by anyone other than the user, then SSH refuses to authenticate.īecause, hackers can easily modify/replace key files, if the parent directories can be written by others. In other words, if any of the files in the. SSH enforces strict permission on key files by default.
#SSH COPY ID PERMISSION DENIED UPDATE#
If that works, we’ll update the customers to check and correct their private key file and location.īut, we always recommend that customers create a new key pair to connect to the server. In this case, the easiest way to confirm that the private key causes problems, is to create a new key pair, and connect with the new set of keys. Similarly, sometimes Droplet owners change the private key name, but use the wrong key name when connecting via SSH. Most often, this error comes up when Droplet owners use the wrong private key to connect to the server. Now, let’s see the main reasons for this error and how our Support Experts fix them. Permission denied (publickey) in DigitalOcean – Causes and Fixes In addition to that, we check the SSH logs( /var/log/auth.log or /var/log secure) to see why this error occurred. It will therefore give a detailed trace of the connection that will help us to analyze the problem. So, our Support Engineers recreate the problem by connecting to the server via SSH in debug mode. Since publickey is shown in the error message, it doesn’t mean that the public key is the problem.Īctually, this error shows that the public key of the Droplet rejects the private key provided during authentication. The error “ Permission denied (publickey)” clearly shows that there is a problem with the SSH keys used for authentication. The public key is placed on the Droplet while the private key is placed on the user’s computer.Īnd, users submit this private key to authenticate and connect via SSH. Permission denied (publickey) in DigitalOcean – What’s this?īefore we go to the reasons of this error, let’s get an idea of this error first.Ī key based authentication needs a private key and a public key pair. Today, we’ll discuss the top 4 reasons of this error and how our Cloud Experts fix them. One such error is “ Permission denied (publickey)“. That was a recent support ticket received at our DigitalOcean Managed Services department where we resolve support queries for web hosts.ĭroplet owners often use key based authentication to improve security on their servers.īut, what happens if these SSH keys are not configured properly? Result is, server denies access and kicks you out with errors.

When I access my server via SSH, it returns permission denied (publickey) error in my DigitalOcean Droplet.
