DEV Community

loading...

Discussion on: DigitalOcean Permission denied (publickey)

Collapse
shinokada profile image
shin • Edited

Thanks for sharing this.
I usually change this:

PermitRootLogin no
Enter fullscreen mode Exit fullscreen mode

I needed one more step.
Once you ssh to your server as a root, I need to copy my root ssh to /home/your-username/.ssh:
Run the following:

rsync --archive --chown=your-username:your-username ~/.ssh /home/your-username
Enter fullscreen mode Exit fullscreen mode

Now you can ssh using your name.