Running a startup program in terminal as sudo
- by Brandon
I need to run a python script in a terminal, myscript.py at startup (on Lubunt). This script requires root.
I've setup a .desktop file that runs the following command:
lxterminal --command="python /home/d/Jarvis/alarm.py && /bin/bash"
The terminal window opens at startup and runs the script, but then closes when the Python script returns an error (because it's not being run as root). When I change the Exec= to this...
lxterminal --command="sudo python /home/d/Jarvis/alarm.py && /bin/bash"
... (prefixing command with 'sudo') which works. However, the terminal opens on startup and displays the
[sudo] password for d: \
prompt, requiring me to input my password. I would like the execution of the python script at startup to be completely automatic with no user interaction.
How can I accomplish this?