leiweibau / Pi.Alert

Scan the devices connected to your WIFI / LAN and alert you the connection of unknown devices. It also warns if a "always connected" device disconnects. In addition, it is possible to check web services for availability. For this purpose HTTP status codes and the response time of the service are evaluated.
https://leiweibau.net
GNU General Public License v3.0
334 stars 25 forks source link

[Bug] Issue when editing config file from WebUI #305

Closed Striffly closed 1 month ago

Striffly commented 2 months ago

Is there an existing issue for this?

Current Behavior

When I edit the configuration file from the WebUI interface, I get an error 500 related to front/php/server/files.php, because the script can't write to config/pialert.conf file.

Environment

OS: Debian 12 Environment: native Platform: Arm

Anything else?

This error is due to the fact that the user www-data does not belong to the group of the user (for example: joe) in which the pialert folder is located (/home/joe). One solution would be to create a dedicated user (pialert) in which the installation would be performed, and add www-data to the pialert group.

leiweibau commented 2 months ago

What is your setup? With a freshly installed Debian 12, the default user is not configured as "sudoer". Did you install Pi.Alert as root, or did you configure your user as "sudoer"?

Striffly commented 2 months ago

I use a Debian 12 with PiHole & PiVPN, & with a custom user who is sudoer (no problem when installing PiHole & PiVPN).

leiweibau commented 2 months ago

I have set up a virtual machine for testing with the Debian 12.5 ISO. I had to do the following things before installing Pi.Alert

  1. add the user to the sudo group
  2. install the package "curl", as this does not seem to be included in the standard installation of Debian 12 (the installation script is updated here).

Then I did an installation with "sudo", which results in Pi.Alert being installed under "/root". Afterwards, the "pialert.conf" could be edited and saved as desired via the web interface.

Here are the permissions of the file after successful editing via the web interface.

pialert config
leiweibau commented 2 months ago

I then deleted Pi.Alert again and reinstalled it under the user I had set up during the installation. Again, everything works as expected.

Here are the permissions of the file after successful editing via the web interface.

pialert config
Striffly commented 1 month ago

Okay, I'll do a double check about this Thank you for your follow-up