Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I set up a server using ubuntu with no gui. I need root for some tasks that I want to autorun on this server. Normally I would just use gksudo because autorun programs never seem to work with su or sudo. gksudo will not run because there is no gui on this server. I decided to install xubuntu-desktop on it but this slows it significantly. What is a way that i can run an autorun file as root without any need for a gui?

By autorun I mean I want to create a sh script that will startup on login. I want it to have root privelages and sh scripts dont work with sudo because they run all the code as the sudo password.

share|improve this question
what do you mean by autorun? – Thomas Mar 11 '13 at 18:58

Possible solutions based on the definition of 'autorun':

  1. Windows 'autorun.ini' files places in media root directories such as CDs or USB sticks. DO NOT RUN AS ROOT, EVER.
  2. Programs run when a user logs in: Running a script after the gui has loaded
  3. Programs run when the computer starts: How to run a script in boot as root
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.