I have a script on my RasPi that on startup is in charge of moving and erasing a bunch of old files.
The script, named "erasePi.py" is called from rc.local
I have had some issues in the past few days with this script, lacking required permissions to erase and copy files.
At the end, I've found I was calling erasePi.py from rc.local with the following line:
sudo python /home/.../erasePi.py
and I changed with:
python /home/.../erasePi.py
since all the scripts run from rc.local have root permissions.
Everything working now, but I would like to ask if this solution is a coincidence of various factors or simply, with that sudo I was triggering an abnormal behavior of Raspbian?
It seems to be that the sudo command was the issue.
As you mentioned in your comment, rc.local file has root permissions. So it is not necessary to include sudo command.
I hope this comment helps you
Kind regards
Delete files on a Raspberry Pi with Python script - permission error