sudo useradd -m -s /bin/bash alice
sudo passwd alice
sudo usermod -aG sudo alice
su - alice
sudo cp -r /home/ubuntu/.ssh .ssh
sudo chown -R alice:alice .ssh
sudo deluser --remove-home ubuntu
sudo vim /etc/ssh/sshd_config
sudo sshd -t
sudo service ssh reload
PasswordAuthentication no
ChallengeResponseAuthentication no
PermitRootLogin no
PermitEmptyPasswords no
sudo passwd -l root
sudo apt update
sudo apt install fail2ban -y
sudo vim /etc/fail2ban/jail.conf
sudo service fail2ban restart
sudo service fail2ban status
ignoreip = 127.0.0.1/8 ::1
[sshd]
enabled = true
https://gist.github.com/miguelmota/9b12335f508481a6cdd642444b3b9b1c