3

I am using portia (https://github.com/scrapinghub/portia) and I have set the following command in my rc.local:

cd /home/portia/portia/slyd && twistd slyd

Problem here is that the command/script get executed as root and all the files/folders that are created by the script have "root" as owner.

How can I run this specific command as a different user?

What I have tried so far:

cd /home/portia/portia/slyd && su jim -c twistd slyd
cd /home/portia/portia/slyd && su jim -c "twistd slyd"
su jim -c "cd /home/portia/portia/slyd && twistd slyd"

Nothing worked.

I am running Ubuntu 12.04 LTS Server.

Thank you!

5
  • Did you see sudo?
    – bain
    May 27, 2014 at 20:55
  • I tried sudo -u jim "cd /home/portia/portia/slyd && twistd slyd" and different variations with and without quotes without success.
    – jimbo
    May 27, 2014 at 22:02
  • What does "nothing worked" mean in this context? Do you mean that the twistd command does not run when invoked via su, or that it runs but the resulting files are still owned by root? May 27, 2014 at 23:56
  • what is the exact output you get from typing at the terminal cd /home/portia/portia/slyd && su jim -c "twistd slyd"?
    – bain
    May 28, 2014 at 10:02
  • bain, the command above gets executed successfully. portia runs. but using the exact command in rc.local does not start the portia server.
    – jimbo
    May 28, 2014 at 17:07

0

You must log in to answer this question.

Browse other questions tagged .