Skip to content

Instantly share code, notes, and snippets.

@blachniet
Last active December 4, 2020 01:53
Show Gist options
  • Save blachniet/710e16bfb8d9eb039d2b912ec4d389c5 to your computer and use it in GitHub Desktop.
Save blachniet/710e16bfb8d9eb039d2b912ec4d389c5 to your computer and use it in GitHub Desktop.

Linode Notes

Tasks

Create non-root user

Create a non-root user in a brand-new Linode. This assumes that you want to use the same SSH key to login with the new user, and that you want that user to have sudo power.

ssh root@<linode-ip>

# Add a new user named 'blachniet' by following the prompts
root@localhost:~$ adduser

# Give this user sudo permissions
root@localhost:~$ cat <<EOF > /etc/sudoers.d/blachniet
blachniet ALL=(ALL) ALL
EOF

# Copy SSH authorized_keys
root@localhost:~$ cp -r .ssh /home/blachniet/.ssh/
root@localhost:~$ chown -R blachniet:blachniet /home/blachniet/.ssh/
root@localhost:~$ chmod 700 /home/blachniet/.ssh/
root@localhost:~$ exit

ssh blachniet@<linode-ip>
blachniet@localhost:~$ sudo ls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment