Unable to add regex/wildcard entry to blacklist

I'm unable to add a domain as a wildcard entry to my blacklist. Adding it as an explicit domain works fine, however trying to add regex or wildcard entries results in an error.

I'm unsure if it's relevant, but the output of ls -l /etc/pihole/regex.list is the following:

-rw-rw-r-- 1 root root 507 Jan 14 21:36 /etc/pihole/regex.list

Expected Behaviour:

Domain is added to blacklist as a regex/wildcard entry

Actual Behaviour:

Popup displays the following message:

Unable to add regex "(^|\.)someDomian\.com$" to /etc/pihole/regex.list
Error message: file_put_contents(/etc/pihole/regex.list): failed to open stream: Permission denied

Debug Token:

https://tricorder.pi-hole.net/8glo4uy6bf

The file permissions I have are not root:

-rw-rw-r-- 1 pihole www-data 47 Jan 23 07:33 /etc/pihole/regex.list

Change ownership with this command:

sudo chown pihole:www-data /etc/pihole/regex.list

Be careful when you add regex - they need to be added as regex. This error in your lighttpd log shows that there was a mistake entering a regex - you likely tried to enter it using the wildcard option, rather than the regex option.

2020-01-24 20:47:27: (^|\.)breitbart\.com$ is not a valid domain

I was just entering breitbart.com and selecting the “Add (wildcard)” button since my regex know-how is a little flaky. Your other reply suggesting the permissions change seems to have fixed the issue!

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.