Skip to content

Instantly share code, notes, and snippets.

@harssh
Forked from learncodeacademy/deployUser.md
Last active September 6, 2022 13:36
Show Gist options
  • Select an option

  • Save harssh/0dd21fccd0e369a9d6ec6f3f15949bdc to your computer and use it in GitHub Desktop.

Select an option

Save harssh/0dd21fccd0e369a9d6ec6f3f15949bdc to your computer and use it in GitHub Desktop.
Adding a deploy user in Linux with some less headache goodies (not typing or using password)

Login to new server as root, then add a deploy user

sudo useradd --create-home deploy
sudo adduser deploy sudo
sudo passwd deploy

Update the password, then Change the new users default to bash by adding /bin/bash to the end of the last line of /etc/passwd

sudo vim /etc/passwd

Now login as that user

Make directory .ssh on the remote server

mkdir .ssh
exit

And add your ssh key to authorized keys

scp ~/.ssh/id_rsa.pub [email protected]:~/.ssh/authorized_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment