Ensure proper permissions are set for gravity.db after creation.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2019-08-05 21:20:07 +02:00
parent 6e2e825a5f
commit 4371c9ba03
No known key found for this signature in database
GPG key ID: FB60471F0575164A
2 changed files with 7 additions and 0 deletions

View file

@ -1908,6 +1908,9 @@ installPihole() {
chmod a+rx /var/www/html chmod a+rx /var/www/html
# Give pihole access to the Web server group # Give pihole access to the Web server group
usermod -a -G ${LIGHTTPD_GROUP} pihole 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 the lighttpd command is executable,
if is_command lighty-enable-mod ; then if is_command lighty-enable-mod ; then
# enable fastcgi and fastcgi-php # enable fastcgi and fastcgi-php

View file

@ -85,6 +85,10 @@ fi
# Generate new sqlite3 file from schema template # Generate new sqlite3 file from schema template
generate_gravity_database() { generate_gravity_database() {
sqlite3 "${gravityDBfile}" < "${gravityDBschema}" 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 # Import domains from file and store them in the specified database table