Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

How can i start a python after a reboot as user xy in Debian Squeeze automatically?

share|improve this question
up vote 1 down vote accepted

Put an entry in rc.local with something similar to the following:

su user_xy -c "" 

to execute the program as that user:

su - user_xy -c ""
share|improve this answer
you can add sudo too ... sudo su - user_xy -c "" – Daniel t. Mar 11 '13 at 16:50
@Danielt. I would strongly advise against using sudo in rc startup scripts (mainly because those scripts are already running as root). – voretaq7 Mar 11 '13 at 17:01
But how can i run it as user_xy, so the process is owned by user_xy? – Ulfric Storm Mar 11 '13 at 20:16
su - user_xy -c "" note the dash. updated answer, accept it if you don't have additional questions – tristan Mar 11 '13 at 20:32

You can use @reboot entry in crontab of user root or user xy. Debian cron supports such entries.

man -S5 crontab

string         meaning
------         -------
@reboot        Run once, at startup.
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.