How do I allow ssh login to non-root user

I have created a new user with: adduser ssadmin

Update authorisations usermod -aG sudo ssadmin

But when I try ssh ssadmin@ I get ssadmin@ Permission denied (publickey)

How do I assign the SSH to the new user

there is no issue logging in as root@

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Site Moderator
Site Moderator badge
May 23, 2024

Heya @chrishunterjohnsonseal,

By default Droplets come with PasswordAuthentication disabled. As such, I’ll recommend you to add an SSH key for the user.

To do so, you’ll need to go to the user’s Home directory, create a directory called .ssh and inside that directory create the file authorized_keys. Inside the file paste the public SSH key for your user.

For further details you can check this Docs page as well:

Bobby Iliev
Site Moderator
Site Moderator badge
May 23, 2024


To allow SSH login for the non-root user ssadmin, you need to copy the SSH public key from the root user’s .ssh/authorized_keys file to the ssadmin user’s .ssh/authorized_keys file.

Here’s a step-by-step guide on how to do this:

  1. Login as root:

    ssh root@
  2. Create the .ssh directory for the new user and set the correct permissions:

    mkdir -p /home/ssadmin/.ssh
    chmod 700 /home/ssadmin/.ssh
  3. Copy the root user’s authorized_keys file to the new user’s .ssh directory:

    cp /root/.ssh/authorized_keys /home/ssadmin/.ssh/
  4. Change the ownership of the .ssh directory and the authorized_keys file to the new user:

    chown -R ssadmin:ssadmin /home/ssadmin/.ssh
  5. Set the correct permissions for the authorized_keys file:

    chmod 600 /home/ssadmin/.ssh/authorized_keys

After completing these steps, you should be able to SSH into the server as the ssadmin user using the same public key authentication method:

ssh ssadmin@

Let me know how it goes!



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel