Skip to content

Instantly share code, notes, and snippets.

@24HOURSMEDIA
Last active July 29, 2023 11:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 24HOURSMEDIA/95f35dc7b8c44b8efabbcb73273b342d to your computer and use it in GitHub Desktop.
Save 24HOURSMEDIA/95f35dc7b8c44b8efabbcb73273b342d to your computer and use it in GitHub Desktop.
public key authentication only
# Add your ssh keys first to .ssh/authorized keys
# Be sure to have the proper permissions:
chmod 700 ~/.ssh
chmod 644 ~/.ssh/authorized_keys
# /etc/ssh/sshd_config.d/pubkey_only.conf
PasswordAuthentication no
PubkeyAuthentication yes
ChallengeResponseAuthentication no
PermitRootLogin no
PermitRootLogin prohibit-password
# remove the password for the user
sudo passwd USERNAME -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment