Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cleberjamaral/3e4743abc3016d87e286876ec20ab050 to your computer and use it in GitHub Desktop.
Save cleberjamaral/3e4743abc3016d87e286876ec20ab050 to your computer and use it in GitHub Desktop.
Create user on sudoers and add key on Linux

Create a local user on sudoers

  1. $ sudo adduser username
  2. Set a local password and user info
  3. $ usermod -aG sudo username
  4. Test the user $ su - username

Send a key from a machine to another and add it on authorized keys

  1. Still logged as 'username', create .ssh folder for 'username' $ mkdir ~/.ssh
  2. Copy public key from a machine to the remote using another ssh account $ scp id_rsa.pub validkey@ip:/tmp/.
  3. Add key to authorized keys ```$ sudo cat /tmp/id_rsa.pub >> /home/username/.ssh/authorized_keys"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment