Running a startup program in terminal as sudo

Posted by Brandon on Ask Ubuntu See other posts from Ask Ubuntu or by Brandon
Published on 2012-10-07T20:17:13Z Indexed on 2012/10/07 21:54 UTC
Read the original article Hit count: 267

Filed under:
|

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?

© Ask Ubuntu or respective owner

Related posts about lubuntu

Related posts about startup