I have a Raspberry Pi running Raspbian that I want to auto-login and then automatically run a program that uses the GPIO as root.
I have auto-login working as per this website.
What is the best way to run a program that needs GPIO? Is it adding the pi
user to sudoers permissions? Or would adding a line with sudo to the bottom of the ~/.bashrc
file? I would guess the second so that the pi
user can't do any other damage?
/etc/rc.local
. That way it runs on startup, regardless of whether autologon is enabled or not. (Commands in/etc/rc.local
are always run as root, so no need to addsudo
).