Skip to content

Instantly share code, notes, and snippets.

@DoZator
Created December 21, 2017 12:22
Show Gist options
  • Save DoZator/13eac0680077ad7b180b6ace58f1d21c to your computer and use it in GitHub Desktop.
Save DoZator/13eac0680077ad7b180b6ace58f1d21c to your computer and use it in GitHub Desktop.
Add user on Ubuntu 16.04 (access with public SSH key)

Add user

    adduser user

Add new user to the 'sudo' group

    usermod -aG sudo user

Passwordless sudo

Edit file /etc/sudoers

    user ALL=(ALL) NOPASSWD:ALL

Copy public SSH key

    cat ~/.ssh/id_rsa.pub | ssh [email protected] "mkdir -p ~/.ssh && cat >>  ~/.ssh/authorized_keys"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment