Skip to content

Instantly share code, notes, and snippets.

@tylerszabo
Last active January 3, 2021 08:01
Show Gist options
  • Save tylerszabo/27f47501937cdc6619df8de0e77b3d80 to your computer and use it in GitHub Desktop.
Save tylerszabo/27f47501937cdc6619df8de0e77b3d80 to your computer and use it in GitHub Desktop.
A litte wrapper for `useradd`
#!/usr/bin/env sh
set -e
if [ -n "$1" -a -n "$2" ]; then
ID_ARGS="--key UID_MIN=$1 --key UID_MAX=$1 --key GID_MIN=$1 --key GID_MAX=$1"
NEW_USER=$2
else
echo "Usage: $0 ID NAME" >&2
exit 1
fi
/sbin/useradd $ID_ARGS --no-create-home --home-dir /nonexistent --shell /sbin/nologin $NEW_USER
id $NEW_USER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment