Skip to content

Instantly share code, notes, and snippets.

@xeoncross
Last active October 14, 2019 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xeoncross/0e6f15f507be70c511aeee7f4a5b8525 to your computer and use it in GitHub Desktop.
Save xeoncross/0e6f15f507be70c511aeee7f4a5b8525 to your computer and use it in GitHub Desktop.
Setup a new user on Ubuntu 18+ VPS
# Assuming you are logged in as root and the ssh key you want to use already installed for root (i.e. new Digital Ocean VPS)
adduser deploy
usermod -aG sudo deploy
mkdir /home/deploy/.ssh
cp /root/.ssh/authorized_keys /home/deploy/.ssh/
chmod 700 /home/deploy/.ssh
chown deploy:deploy -R /home/deploy/.ssh
# Now switch to user and create a deployment ssh key (if desired)
su - deploy
cd /home/deploy/.ssh/
ssh-keygen -f id_rsa -t rsa -N ''
@xeoncross
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment