-
-
Save jondb/27f5395fbebf9701d71a 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 | |
# Run this on every server: | |
# curl https://gist.githubusercontent.com/jondb/27f5395fbebf9701d71a/raw/ceba1231a5903566c5e24c61d0ce01f3e4e02a02/key | sudo sh | |
user=jon | |
key='ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCgJaMxxNllVsb7kMRPP/95skzfGMEYtbt2r30bQZ0vt/4KMRgrX4eK8tyCbXY9g4ohmMy/iSm+b5SVwLnV58haoQYvLOuauSO8N+Gvrgi5q7vU5XXzKm2JXfwORCBwlxv37c/5YSRL1IyATlIH4iex17L26bwdwScU6wfrFpUjxN+tNlcGVR79e2TZ1Xdtmwz7+JkCIMHj+sVrauSQvmwhj81nPwiHQqFV28vwNRHV8RX30HZMHo22kTmwNbs+U7EYiIFAeihvdR0ui77B2e54ARyBF+fm2Z9+N6wWk2qM1UyyW6tmiEMwCSvjfhTCU4cdVaHX9FJ9r32/Zu/rCyq1 [email protected]' | |
/usr/sbin/useradd -m $user -s /bin/bash | |
passwd -d $user | |
chage -d 0 $user | |
cd /home/$user | |
mkdir .ssh | |
echo $key > .ssh/authorized_keys | |
chmod 700 .ssh | |
chmod 600 .ssh/authorized_keys | |
chown -R ${user}:${user} .ssh | |
/usr/sbin/usermod -a -G admin $user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment