Initial Server on Setup Debian 9

This guide is deprecated. Check out theel0ja/automated-setups.

Prevent login without pubkey

Change this in /etc/ssh/sshd_config:

PermitRootLogin yes


PermitRootLogin no

and this:

#PasswordAuthentication yes

to this:

PasswordAuthentication no

SSH tweaks

Comment out line with AcceptEnv LANG LC_*

Create new user

adduser eliaso


apt update
apt install sudo -y

# add your user to sudo group
usermod -aG sudo eliaso

setup firewall

sudo apt install ufw -y

Then, proceed here:—-setting-up-a-basic-firewall

enable login for your new user

sudo apt install rsync -y
rsync --archive --chown=eliaso:eliaso ~/.ssh /home/eliaso

Then, restart sshd with the following command:

sudo service sshd restart

Then, login to your new user. Try sudo whoami for root.