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 want a script to switch users and perform an action, but so far I have this:


 sudo su partner -s /bin/bash 
 supervisord -c ~/supervisord.conf

I want that the user partner execute supervisord and exit, but all I get is a switched user in the comand line a bash shell, doing the su partner -s /bin/bash is the only way in which I can access the partner user.

Please Help

share|improve this question
sudo su partner -c supervisord? – Rmano Apr 16 '14 at 22:39
Sorry I forgot my .conf file, I tried that way and it did not work, I'll edit my question – ocespedes Apr 16 '14 at 22:51
@Rmano Had the right idea. sudo su partner -s /bin/bash -c 'supervisord -c ~/supervisord.conf' That is assuming ~/supervisord.conf is in fact in the partner user's home directory. – ptierno Apr 16 '14 at 22:53
up vote 5 down vote accepted

You should use sudo -u partner supervisord -C ~/supervisord.conf instead, and set up your current user in the /etc/sudoers file. An entry to allow user "current" to execute this command as "partner" would look something like this:

current ALL=(partner:partner) NOPASSWD: /path/to/supervisord

Make sure and use visudo instead of trying to edit the sudoers file manually. There is a more in-depth but simple explanation of the sudoers file syntax here.

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.