Skip to content

Instantly share code, notes, and snippets.

@JoshuaEstes
Last active October 10, 2015 07:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JoshuaEstes/3658524 to your computer and use it in GitHub Desktop.
Save JoshuaEstes/3658524 to your computer and use it in GitHub Desktop.
Script to create a deployment user on a linux box
# Remote Server
useradd www-deploy -c "Deployment User" -d /home/www-deploy -G www-data -m -s /bin/bash
sudo su - www-deploy
# Localhost
ssh-keygen -t rsa
# Append your key to the Remote host authorized keys file
cat id_rsa.pub >> ~/.ssh/authorized_keys
# Remote Host
#vim /etc/ssh/sshd_config
sed -i '/^#*RSAAuthentication /c RSAAuthentication yes' /etc/ssh/sshd_config
sed -i '/^#*PubkeyAuthentication /c PubkeyAuthentication yes' /etc/ssh/sshd_config
sed -i '/^#*ChallengeResponseAuthentication /c ChallengeResponseAuthentication no' /etc/ssh/sshd_config
sed -i '/^#*PasswordAuthentication /c PasswordAuthentication no' /etc/ssh/sshd_config
sed -i '/^#*UsePAM /c UsePAM no' /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