Created
August 20, 2011 07:10
-
-
Save yunazuno/1158787 to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# | |
# Create user with specified uid and gid. | |
# Tested on Ubuntu 10.04 | |
# | |
if [ $# -ne 3 ]; then | |
echo 'Usage:' $0 'USERNAME UID GID' 1>&2 | |
exit 1 | |
fi | |
USERNAME=$1 | |
UserID=$2 | |
GroupID=$3 | |
GROUPS="adm dialout cdrom plugdev lpadmin admin" | |
sudo addgroup --gid $GroupID $USERNAME | |
sudo adduser --uid $UserID --gid $GroupID --gecos '' $USERNAME | |
for GROUP in $GROUPS; do | |
sudo gpasswd -a $USERNAME $GROUP | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment