Changing ownership of / root / boot

I need to access / boot so that I can constantly change the file using a PHP script (To enable raspberry pi and disable it by changing start_x = ''). However, this is due to a change in download permissions.

I've tried sudo chown -R / boot and am still getting permissions denied when running as root. Also tried FTP and changed the upload folder to allow users to modify the content, however that didn't work either.

Is there anyway to get around this?

<?php
$myfile = fopen("config.txt", "w") or die("Unable to open file!");
[...]
?>

      

Update: I tried chmod 775 / boot / config.txt as well as symlink (started successfully) so I have a shortcut in /var/www/

, however when trying to save PHP script in config.txt

(in www) still get permission even though this shortcut is set at 775. The issue still persists when changing to change the resolution of the original file to /boot

.

+3


source to share


2 answers


Try to start a shell and try the command:

sudo sh -c "echo 123 >/boot/test"

      

works but



sudo echo 123 >/boot/test

      

fails. I don't understand the reason for this difference.

The php user will need the permissions set in sudoers.d to execute the required commands.

0


source


Try it like this:



sudo chown -R root /root/boot

      

0


source







All Articles