From 4c9205b5b3dd325716efc035dc8cdaab40be4b17 Mon Sep 17 00:00:00 2001 From: Chad Howell Date: Sat, 23 Jan 2016 16:48:56 -0500 Subject: [PATCH] Add user pihole if user does not exsist Check if user pihole exist and add if not. This will give pihole its own system user without a login or home directory that is not system dependent. --- automated install/basic-install.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index ba7e57f0..4550b87f 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -375,7 +375,7 @@ stopServices $SUDO mkdir -p /etc/pihole/ $SUDO chown www-data:www-data /var/www/html $SUDO chmod 775 /var/www/html -$SUDO usermod -a -G www-data pi +$SUDO usermod -a -G www-data pihole $SUDO lighty-enable-mod fastcgi fastcgi-php installScripts installConfigs @@ -397,6 +397,18 @@ If you set a new IP address, you should restart the Pi. The install log is in /etc/pihole." $r $c } +setUser() +{ +# Check if user pihole exists and create if not +echo "Checking if user 'pihole' exists..." +if id -u pihole >/dev/null 2>&1; then + echo "User 'pihole' already exists" +else + echo "User 'pihole' doesn't exist. Creating..." + $SUDO useradd -r -s /usr/sbin/nologin pihole +fi +} + ######## SCRIPT ############ # Start the installer welcomeDialogs