Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save TommyStarK/513c6ad2e4ca41b2c1cdf8ac6367349b to your computer and use it in GitHub Desktop.
Save TommyStarK/513c6ad2e4ca41b2c1cdf8ac6367349b to your computer and use it in GitHub Desktop.
Create new user on linux with ssh access and grant docker permissions

Update words in capital letters with the proper values

$ ssh -p PORT ADMIN_USER@HOST
$ sudo groupadd USER
$ sudo useradd --home /home/USER --create-home --groups USER,docker --gid USER --shell /bin/bash USER
$ cd /home/USER
$ sudo mkdir .ssh
$ sudo cat USER_SSH_PUB_KEY >> .ssh/authorized_keys
$ sudo chown -R USER:USER .ssh
$ sudo chmod 700 .ssh/
$ sudo chmod 600 .ssh/authorized_keys
$ sudo chown -R USER:USER .ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment