Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am setting up a machine that's sole purpose is to run a specific python application that uses a curses ui. That being said, there are some aspects of the application that require it to be run as su.

How can I run this application on login so the user doesn't need to execute it every time? I have seen Is there a script that runs as root when user logs in? and it seems different than mine as they don't actually require su there.

I really don't care about security at all for this application, it's not online nor will it ever be online. I don't even care if I have to enter my credentials twice either. I just want it to execute the line:

sudo python ~/Application/main.py

on login. If there's a more efficient way where I don't have to enter credentials twice, that would be even better. This has to work on Ubuntu Server as well.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

I found a solution through this stack overflow answer: http://stackoverflow.com/questions/4128817/how-can-i-execute-a-command-when-i-first-login-to-my-unix-server which works for me. I just added

cd ~/Application
sudo python main.py

share|improve this answer

Your Answer

 
discard

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.