I have created a Droplet and connect to it passwordless via SSH as root. While logged in as root, I created a new user ‘deploy’ which I want to use to deploy my app.
But, when I try to ‘ssh deploy@ipaddr’ I get this error message: Permission denied (publickey).
I’m guessing it’s trying to authenticate with my root key instead of asking me for the deploy users password. How can I get around this little issue?
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!
HI @nolyoi,
By default, the servers in DigitalOcean come with Password Authentication disabled. In this regard, when creating a new user, it would be best to create a home directory for it as well. In that home user directory, you can add your SSH key.
Another solution would be to enable password authentication and you would be able to ssh to the user with the password you’ve set it up for. Let me know which of the two you would prefer more and I’ll provide you with detailed steps.
Regards, KFSys
I guess that you have not properly configure SSH access for the deploy account. Assuming that you use the same computer (or the same private key) to connect to the deploy and root accounts on your server. You must add the corresponding public key to the ~/.ssh/authorized_keys file of your deploy account. After logging in to your root account, run the following command:
- rsync --archive --chown=deploy:deploy ~/.ssh/authorized_keys /home/deploy/.ssh
Then, you can login the deploy account with ssh deploy@ipaddr
You may read this tutorial for more information: Initial Server Setup with Ubuntu 20.04. It contain links for other operating systems too.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.