Skip to content

Instantly share code, notes, and snippets.

@nazariyv
Created August 4, 2025 13:53
Show Gist options
  • Save nazariyv/778db0d90a606ccede2006059f467aea to your computer and use it in GitHub Desktop.
Save nazariyv/778db0d90a606ccede2006059f467aea to your computer and use it in GitHub Desktop.
new-ubuntu-user-creation-steps
# 1 Create a dedicated user
sudo adduser new_username # choose a strong password
# 2 Let that user sudo *only* when really needed
sudo usermod -aG sudo new_username
# 3 Switch to it
su - new_username
# 4 Copy your SSH key so you can log in directly
mkdir -p ~/.ssh && chmod 700 ~/.ssh
cat /tmp/your_pubkey.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment