From 4371c9ba03e48daa2f40e1dbe31c1b3bd72d2447 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Mon, 5 Aug 2019 21:20:07 +0200 Subject: [PATCH] Ensure proper permissions are set for gravity.db after creation. Signed-off-by: DL6ER --- automated install/basic-install.sh | 3 +++ gravity.sh | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 1e87b943..7dbdc596 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1908,6 +1908,9 @@ installPihole() { chmod a+rx /var/www/html # Give pihole access to the Web server group usermod -a -G ${LIGHTTPD_GROUP} pihole + # Give lighttpd access to the pihole group so the web interface can + # manage the gravity.db database + usermod -a -G pihole ${LIGHTTPD_USER} # If the lighttpd command is executable, if is_command lighty-enable-mod ; then # enable fastcgi and fastcgi-php diff --git a/gravity.sh b/gravity.sh index f9ecc1d1..1ad43df1 100755 --- a/gravity.sh +++ b/gravity.sh @@ -85,6 +85,10 @@ fi # Generate new sqlite3 file from schema template generate_gravity_database() { sqlite3 "${gravityDBfile}" < "${gravityDBschema}" + + # Ensure proper permissions are set for the newly created database + chown pihole:pihole "${gravityDBfile}" + chmod g+w "${piholeDir}" "${gravityDBfile}" } # Import domains from file and store them in the specified database table