Created
February 14, 2017 04:16
-
-
Save stephenlb/d26f4e125bcbb922cae6c7ce4c8402f3 to your computer and use it in GitHub Desktop.
Adding a User to Debian
This file contains hidden or 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
| USER="$1" | |
| echo "Making user account for: $USER" | |
| useradd -m -d /home/$USER -s /bin/bash $USER | |
| usermod -aG sudo $USER | |
| mkdir /home/$USER/.ssh | |
| touch /home/$USER/.ssh/authorized_keys | |
| chmod 700 /home/$USER/.ssh | |
| chmod 600 /home/$USER/.ssh/authorized_keys | |
| chown -R $USER:$USER /home/$USER/.ssh | |
| echo "Setup Password for SUDO: $USER" | |
| passwd $USER |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
./makeuser.sh sally ## then add `id_rsa.pub` key to ~sally/.ssh/authorized_keys