Created: Fri Aug 24 20:40:51 CEST 2018
Last modiﬁed: Thu Apr 18 21:15:56 CEST 2019
DigitalOcean droplets support preconﬁguration of SSH keys. The only issue is they are automatically added to the root user. I want access to a more restricted account.
This tutorial is a summary of how I set up my servers regarding this.
First of all, generate a new ssh key with
copy-paste the public key to your DigitalOcean account.
I assume your ssh public key is remotely stored in
Depending on wether you chose Debian or Fedora, there exist another user on you server, beside root, which is named debian (or fedora). But you can’t use it directly for now, because your ssh key has been setup for the root account.
The simple way to change that:
cp -r ~/.ssh /home/debian/ chown -R debian:debian \ /home/debian/.ssh
You can now login via ssh(1) using the debian (or fedora) account.
And you should. Exit your current ssh session and log in as debian.
/etc/ssh/sshd_config as root.
# PermitRootLogin yes PermitRootLogin no
service sshd restart and its done.