Skip to content

Instantly share code, notes, and snippets.

@igolden
Last active September 7, 2017 21:57
Show Gist options
  • Save igolden/3dcd87ad9c08883e3726a4fe8dc8de22 to your computer and use it in GitHub Desktop.
Save igolden/3dcd87ad9c08883e3726a4fe8dc8de22 to your computer and use it in GitHub Desktop.
Adds a new user
#!/bin/bash
set -e
echo "This tool will create a new sudo user."
echo "================================================"
echo ""
echo "Choose username:"
read NEWUSER
echo "Choose password:"
read PASSWORD
echo "Creating user, setting 'defaultpass', adding to sudoers"
useradd $NEWUSER
echo $NEWUSER:$PASSWORD | /usr/sbin/chpasswd
echo "$NEWUSER ALL=(ALL:ALL) ALL" >> /etc/sudoers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment