23 lines
No EOL
454 B
Bash
23 lines
No EOL
454 B
Bash
export MY_USER="my_user"
|
|
|
|
# Create non-root user
|
|
adduser $MY_USER
|
|
usermod -aG sudo $MY_USER
|
|
|
|
# Set up firewall
|
|
ufw allow OpenSSH
|
|
ufw enable
|
|
|
|
# Disable ssh password login
|
|
# sudo nano /etc/ssh/sshd_config
|
|
# PermitRootLogin no
|
|
# PasswordAuthentication no
|
|
# ChallengeResponseAuthentication no
|
|
# UsePAM no
|
|
# sudo systemctl restart ssh
|
|
|
|
# Enable ssh login
|
|
rsync --archive --chown=$MY_USER:$MY_USER ~/.ssh /home/$MY_USER
|
|
|
|
# Fail2ban for SSH
|
|
apt install fail2ban |