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

My capistrano deploy.rb has a foreman export command for a rails app on Ubuntu 10.04 So, while deploying, I want to export the foreman to upstart script. But doing that, the command rvmsudo foreman export ... asks for root password and I cannot do anything. Googled a lot and tried with various tweaks but nothing worked.

 * executing `foreman:export'
 * executing "cd /home/deploy/zappy/releases/20111019175422 && rvmsudo foreman export upstart /etc/init -a zappy -u deploy -f ./Procfile.production -c worker=1 redis=1 -l /home/deploy/zappy/releases/20111019175422/log/foreman"
   servers: [""]
   [] executing command
** [out ::] [sudo] password for deploy:

What could be the solution to do it password-less way?

share|improve this question

I had this same problem/question. Here's a snippet from my working deploy.rb file. Note: I've altered /etc/sudoers to allow my deploy user to run the sudo mv... command

foreman_temp = "/tmp/#{application}-foreman"
run [
  "mkdir -p #{foreman_temp}",
  "cd #{release_path}",
  "/usr/local/rvm/gems/ruby-1.9.2-p290/bin/bundle exec foreman export upstart #{foreman_temp} -a #{application} -u #{user} -l #{shared_path}/log -f Procfile",
  "sudo mv #{foreman_temp}/#{application}*.conf /etc/init/",
  "rm -rf #{foreman_temp}"
share|improve this answer
Looks good enough. Can't now, but will try in the evening and see. – Millisami Oct 25 '11 at 5:40
I found this after struggling with rvmsudo for two days. Thanks! Works like a charm. – Andreas Lyngstad Sep 19 '13 at 17:52

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.