Created
August 9, 2014 09:20
-
-
Save smoser/e2e53b84431485c17e27 to your computer and use it in GitHub Desktop.
This file contains 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/sh | |
## | |
## this is run on new cloudatcost.com system, to get me more set up | |
## disables root password login and adds my user. | |
## | |
bdimage="http://bazaar.launchpad.net/~smoser/+junk/backdoor-image/download/head:/backdoorimage-20121004180823-pi43gdnl3fbp82la-1/backdoor-image" | |
me_ssh_id="smoser" | |
gecos="Scott Moser" | |
user="smoser" | |
cfg="/etc/ssh/sshd_config" | |
if grep -q PermitRootLogin "$cfg"; then | |
if ! grep "^PermitRootLogin.*without-password" "$cfg"; then | |
sed -i 's,[#]*PermitRootLogin,PermitRootLogin without-password,' "$cfg" | |
fi | |
else | |
echo PermitRootLogin without-password >> "$cfg" | |
fi | |
pkgs="ssh-import-id git-core eatmydata" | |
apt-get update --quiet | |
apt-get install --assume-yes --quiet $pkgs | |
wget "$bdimage" -O "insert-user" | |
chmod 755 insert-user | |
./backdoor-image --import-id="$me_ssh_id" "--user=$user" --force / | |
sed -i "s,:backdoor:,:$gecos:," /etc/passwd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment