schollz / raspberry-pi-turnkey

How to make a Raspberry Pi image that can be deployed anywhere and assigned to a WiFi network without SSH :ok_hand:
MIT License
832 stars 90 forks source link

No need to use sudo by root. #2

Closed skx closed 6 years ago

skx commented 6 years ago

You mention adding this to the crontab of the root-user:

   @reboot cd /home/pi/raspberry-pi-turnkey && /usr/bin/sudo /usr/bin/python3 startup.py

Since this will be run by root there is no need for the use of sudo. You could simplify to:

   @reboot cd /home/pi/raspberry-pi-turnkey &&  /usr/bin/python3 startup.py
schollz commented 6 years ago

I think I will actually need to change this.

Use the root crontab becomes problematic when you want to use some of the PATH variables of the pi user (i.e. in the case of using the Go/npm binaries I installed in the tutorial). In this case I think I will change it so pi is added to the sudoers and the crontab is run from the user.

schollz commented 6 years ago

I'm using /etc/rc.local now and switching to the pi user to fix this.