Skip to content

Instantly share code, notes, and snippets.

@GiovanniFrigo
Last active November 12, 2018 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GiovanniFrigo/704b12a5fe46f5f1b10fc9c60b6c817d to your computer and use it in GitHub Desktop.
Save GiovanniFrigo/704b12a5fe46f5f1b10fc9c60b6c817d to your computer and use it in GitHub Desktop.
Adding a new user to a Ubuntu/Debian server
# Let' add Mario to the server
# Add the user with the interactive shell
adduser mario
# Check the creation of the user home directory
ls -al /home/mario/
# and set the default console to bash
chsh -s `which bash` mario
# Add the ssh key for mario here:
mkdir /home/mario/.ssh/
nano /home/mario/.ssh/authorized_keys
# Add the user to the users allowed to use ssh
nano /etc/ssh/sshd_config
# and edit/add the line
AllowUsers root mario luigi yoshi
# restart the ssh agent
/etc/init.d/ssh restart
# optional: add the user to the sudoers
sudo usermod -aG sudo mario
# bonus: you can change the user password with
passwd mario
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment