Skip to content

Instantly share code, notes, and snippets.

@ryancragun
Created April 15, 2011 17:55
Show Gist options
  • Save ryancragun/922133 to your computer and use it in GitHub Desktop.
Save ryancragun/922133 to your computer and use it in GitHub Desktop.
remove password auth
#!/bin/bash -e
# Ryan C.
# Disable SSH password auth
if [ $RS_DISTRO = ubuntu ]; then
ssh="ssh"
elif [ $RS_DISTRO = centos ]; then
ssh="sshd"
fi
if [ -e /etc/ssh/sshd_config ]; then
sed -i 's/PasswordAuthentication yes/#PasswordAuthentication yes/g' /etc/ssh/sshd_config
sed -i 's/PermitRootLogin yes/#PermitRootLogin yes/g' /etc/ssh/sshd_config
/etc/init.d/$ssh restart
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment