Last active
November 12, 2018 14:49
-
-
Save GiovanniFrigo/704b12a5fe46f5f1b10fc9c60b6c817d to your computer and use it in GitHub Desktop.
Adding a new user to a Ubuntu/Debian server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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