Server Fault is a question and answer site for system and network administrators. 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'm able to run a user-data script successfully, but it runs as root. I start up a few long running processes with this script, and would like them to be non-privileged processes. Is there some way to accomplish this, either with user-data scripts or some other method? I'm running an AMI based on Amazon Linux 2012.03.

share|improve this question
up vote 2 down vote accepted

Amazon Linux uses cloud-init to implement the ability to run scripts from user-data, a tool invented by, and expanded by Ubuntu. It is currently supported by the Ubuntu distro (via the cloud-init package), and by the Amazon Linux distro.

I'm not aware of a built-in way to run as a different user, but since cloud-init supports shell-scripts you could just run a script that starts a process as another user. The standard unix tools are available for this, such as sudo or su.

share|improve this answer
Thanks, I probably should have thought of that :) – Ryan May 19 '12 at 21:00

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.