Skip to content

Instantly share code, notes, and snippets.

@umhan35
Created April 5, 2015 16:21
Show Gist options
  • Save umhan35/4bb836b87bead5071af8 to your computer and use it in GitHub Desktop.
Save umhan35/4bb836b87bead5071af8 to your computer and use it in GitHub Desktop.
addnginxuser
addnginxuser() {
# creating nginx group if he isn't already there
if ! getent group nginx >/dev/null; then
addgroup --system nginx >/dev/null
fi
# creating nginx user if he isn't already there
if ! getent passwd nginx >/dev/null; then
adduser \
--system \
--disabled-login \
--ingroup nginx \
--no-create-home \
--home /nonexistent \
--gecos "nginx user" \
--shell /bin/false \
nginx >/dev/null
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment