#!/bin/sh LOG_FILE=/var/log/cryptobox.log CRYPTOBOX_USER=cryptobox # create mount and config directories with appropriate permissions test ! -e "$LOG_FILE" && mkdir -p "$(dirname $LOG_FILE)" && touch "$LOG_FILE" && chown "$CRYPTOBOX_USER" "$LOG_FILE" if getent passwd "$CRYPTOBOX_USER" 2>/dev/null >/dev/null then # do nothing - the user already exists true else # create cryptobox user echo "Creating new user '$CRYPTOBOX_USER' ..." USER_HOME=/var/cache/cryptobox adduser --system --group --home "$USER_HOME" cryptobox mkdir "$USER_HOME/mnt" chown -R ${CRYPTOBOX_USER}: "$USER_HOME" # only members of the cryptobox group may access the user directory chmod 750 "$USER_HOME" fi #DEBHELPER# true