Skip to content

Instantly share code, notes, and snippets.

@chernjie
Last active August 29, 2015 14:24
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 chernjie/a460bd042f4de18e8656 to your computer and use it in GitHub Desktop.
Save chernjie/a460bd042f4de18e8656 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Set the following SSH configurations to no:
# ChallengeResponseAuthentication
# PasswordAuthentication
# UsePAM
test -f /etc/ssh/sshd_config || exit 1
sed -i -r -e \
"s/^(ChallengeResponseAuthentication|PasswordAuthentication|UsePAM)\s+\S+$/\1 no/g" \
/etc/ssh/sshd_config
grep -e ^ChallengeResponseAuthentication -e ^PasswordAuthentication -e ^UsePAM /etc/ssh/sshd_config
service ssh restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment