Skip to content

Instantly share code, notes, and snippets.

@stephenlb
Created February 14, 2017 04:16
Show Gist options
  • Select an option

  • Save stephenlb/d26f4e125bcbb922cae6c7ce4c8402f3 to your computer and use it in GitHub Desktop.

Select an option

Save stephenlb/d26f4e125bcbb922cae6c7ce4c8402f3 to your computer and use it in GitHub Desktop.
Adding a User to Debian
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
@stephenlb

stephenlb commented Feb 25, 2017

Copy link
Copy Markdown
Author

Usage

./makeuser.sh sally
## then add `id_rsa.pub` key to ~sally/.ssh/authorized_keys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment