Skip to content

Instantly share code, notes, and snippets.

@xholicka
Created June 7, 2022 23:12
Show Gist options
  • Save xholicka/6fee564c49ae4da31b34d23811bead5e to your computer and use it in GitHub Desktop.
Save xholicka/6fee564c49ae4da31b34d23811bead5e to your computer and use it in GitHub Desktop.
sudo apt install libpam-google-authenticator
google-authenticator
lastpass authentictor, google authenticator
sudo vim /etc/pam.d/sshd
auth required pam_google_authenticator.so
sudo nano /etc/ssh/sshd_config
ChallengeResponseAuthentication yes
sudo systemctl restart sshd
sudo nano /etc/pam.d/sshd
#@include common-auth
sudo nano /etc/ssh/sshd_config
AuthenticationMethods publickey,keyboard-interactive
sudo systemctl restart sshd
sudo apt install fail2ban
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
sudo vim /etc/fail2ban/jail.local
enabled = true
filter = sshd
port = ssh
banaction = iptables-multiport
bantime = 60m
maxretry = 3
sudo service fail2ban restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment