Last active
May 5, 2018 10:00
-
-
Save NunoFilipeSantos/7eee84fcb40b52d5ede6332f902d1b1c to your computer and use it in GitHub Desktop.
Disable root access via SSH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Disable root access via SSH | |
# USAGE: | |
# curl -Lo DisableRootAccessSSH https://gist.githubusercontent.com/NunoFilipeSantos/7eee84fcb40b52d5ede6332f902d1b1c/raw/DisableRootAccessSSH.sh | |
# chmod +x DisableRootAccessSSH | |
# ./DisableRootAccessSSH | |
perl -pi -e 's/PermitRootLogin yes/PermitRootLogin no/g' /etc/ssh/sshd_config | |
service ssh restart | |
echo "Root access via SSH disabled!" | |
# Delete this file after executing | |
rm -- "$0" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment