Last active
February 20, 2022 23:44
-
-
Save randomessence/5be2bb13213aedca4ea6 to your computer and use it in GitHub Desktop.
nuke it
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 | |
# Nuke it, baby | |
# | |
if [[ "$(hostname)" = 'metis' ]] | |
then | |
echo | |
echo -e "\033[36m""This is the metis slot, i am exiting""\e[0m" | |
echo | |
exit | |
fi | |
# | |
areyoursure="" | |
# | |
echo | |
echo -e "You are about to nuke" "\033[31m""$(hostname)""\e[0m" | |
echo | |
read -ep "Are you sure you want to nuke this slot: $(hostname)? [y]es or [n]o: " areyoursure | |
# | |
if [[ "$areyoursure" =~ ^[Yy]$ ]]; then | |
shopt -s dotglob | |
rm -rf ~/* | |
find . -delete | |
# | |
cp -f /etc/skel/.{bash_aliases,bash_logout,bashrc,profile} ~/ | |
chmod 644 ~/.{bash_aliases,bash_logout,bashrc,profile} | |
# | |
mkdir -p ~/.ssh | |
chmod 700 ~/.ssh | |
wget -qO ~/.ssh/authorized_keys http://git.io/vvpZA | |
chmod 600 ~/.ssh/authorized_keys | |
# | |
mkdir -p ~/bin | |
mkdir -p ~/.apache2/conf.d | |
mkdir -p ~/private/ | |
mkdir -p ~/www/$(whoami).$(hostname -f)/public_html/ | |
ln -s ~/www/$(whoami).$(hostname -f) ~/www/$(whoami).$(hostname) | |
# | |
read -ep "Change password? [y/n]: " -i "n" changepass | |
if [[ "$changepass" =~ ^[Yy]$ ]] | |
then | |
passwd | |
fi | |
# | |
kill -9 -1 | |
else | |
echo "Nothing was changed." | |
exit | |
fi | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment