PHP server side scripting

As whoami when running in a PHP script shows, the user www-data runs the PHP script.

Therefor the PHP has just the rights of the user www-data and might not run system commands commands as wg to check the wireguard connections.

There are very good reason why this is like that.

It is more secure to run a cron service and write data to the disk (ram disk if it changes frequently) then have php read from the disk.

If security is not of concern php can get more rights.

The user www-data must be added to the sudo group in /etc/groups

cp /etc/sudoers.d/010_<user>-nopasswd /etc/sudoers.d/010_www-data-nopasswd and then adjust the new file.

Linurs startpage