Created
March 5, 2014 07:07
-
-
Save chloerei/9362532 to your computer and use it in GitHub Desktop.
Create a deploy user with githu keys when setup vps
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/bash | |
USER=deploy | |
KEYS_PATH=https://github.com/chloerei.keys | |
useradd -s /bin/bash -m deploy | |
passwd $USER | |
adduser $USER sudo | |
mkdir /home/$USER/.ssh | |
wget $KEYS_PATH -O /home/$USER/.ssh/authorized_keys | |
chmod 700 /home/$USER/.ssh | |
chmod 600 /home/$USER/.ssh/authorized_keys | |
chown -R $USER:$USER /home/$USER/.ssh/ | |
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config | |
service ssh restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment