Ubuntu - Run command on start-up with "sudo"

Mark Willis picture Mark Willis · Mar 13, 2012 · Viewed 111.1k times · Source

I would like to run a sudo command when Ubuntu starts up (before anyone logs in):

sudo searchd

How would I do this?

Answer

Didier Trosset picture Didier Trosset · Mar 13, 2012

You can add the command in the /etc/rc.local script that is executed at the end of startup.

Write the command before exit 0. Anything written after exit 0 will never be executed.