Last active
January 3, 2021 08:01
-
-
Save tylerszabo/27f47501937cdc6619df8de0e77b3d80 to your computer and use it in GitHub Desktop.
A litte wrapper for `useradd`
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
#!/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