Last active
August 2, 2016 13:11
-
-
Save Ham5ter/9e99430088f1c476a67ae864d13957cc to your computer and use it in GitHub Desktop.
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 | |
# | |
# This Script sets a random root password, disables the root user and deletes itself afterwards! | |
# Put this Script in the "/etc/rc5.d/" directory. | |
# | |
# Version: 1.0 | |
# Author: [email protected] | |
# Date 02.08.2016 | |
genpasswd() { | |
local l=$1 | |
[ "$l" == "" ] && l=16 | |
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs | |
} | |
echo "root:$(genpasswd 64)" | chpasswd | |
passwd -l root | |
# Delete the Script itself! | |
/bin/rm $0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment