Skip to content

Instantly share code, notes, and snippets.

@paveljurca
Last active July 20, 2017 14:26
Show Gist options
  • Save paveljurca/5323ad4cd60ca759f6485a571f72b845 to your computer and use it in GitHub Desktop.
Save paveljurca/5323ad4cd60ca759f6485a571f72b845 to your computer and use it in GitHub Desktop.
make user
#!/bin/sh
LOGIN=$0
NAME=$1
read PASS
# useradd won't create home directory from /etc/skel unless using the -m option
# TIP: adduser is an interactive Perl frontend around useradd
useradd -u $ID -g 100 -c "$NAME,,," -m $LOGIN -n
echo "$LOGIN:$PASS" | chpasswd
chmod 701 /home/$LOGIN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment