Report this

What is the reason for this report?

I want to add an additional user with SSH key access

Posted on September 5, 2015

I already have a droplet setup with SSH key for root. Now I want to add an additional user with limited capability (Someone who can just deploy application on tomcat etc), with the same SSH key. How should I do it?



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!

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.

You could login as the root user on the droplet. After this create a new user (on CentOS: useradd username). After you’ve created the user, login as this user (can be done directly from root: su username).

Now edit the file: ~/.ssh/authorized_keys and paste the public key in this file. Save it and make sure you chmod it to 600. Now you could login as the newly created user with the SSH key.

If you’re unable to login, please check the /var/log/secure login (as the root user) to see why you can’t login. If it says something about not in the AllowUsers, then: nano /etc/ssh/sshd_config and at the end of the file, you could add the user: AllowUser username. Make sure to restart ssh.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.