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 not familiar with Ubuntu and some problem with server settings for my Rails app.

I've created deployer user in admin group (%admin ALL=(ALL) ALL). It was all ok, but when I'm trying to start Unicorn service, getting Permission denied message:

deployer@myvpsserver:~$ /etc/init.d/unicorn_myapp start
-bash: /etc/init.d/unicorn_myapp: Permission denied

Here is my /etc/init.d/unicorn_myapp:

# Provides:          unicorn
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Manage unicorn server
# Description:       Start, stop, restart unicorn server for a specific application.
set -e

# Feel free to change any of the following variables for your app:
CMD="cd $APP_ROOT; bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E production"
set -u


sig () {
  test -s "$PID" && kill -$1 `cat $PID`

oldsig () {
  test -s $OLD_PIN && kill -$1 `cat $OLD_PIN`

run () {
  if [ "$(id -un)" = "$AS_USER" ]; then
    eval $1
    su -c "$1" - $AS_USER

case "$1" in
  sig 0 && echo >&2 "Already running" && exit 0
  run "$CMD"
  sig QUIT && exit 0
  echo >&2 "Not running"
  sig TERM && exit 0
  echo >&2 "Not running"
  sig HUP && echo reloaded OK && exit 0
  echo >&2 "Couldn't reload, starting '$CMD' instead"

Result of ls -l /etc/init.d/unicorn_myapp

lrwxrwxrwx 1 root root 63 Aug  8 23:13 /etc/init.d/unicorn_myapp ->      
share|improve this question
Can you post your /etc/init.d/unicorn_myapp script? Also, post the output from ls -l /etc/init.d/unicorn_myapp – Chris McCauley Aug 9 '12 at 8:40
I've added unicorn_myapp :) – ANATHEM Aug 9 '12 at 9:25
up vote 1 down vote accepted

You might need sudo /etc/init.d/unicorn_myapp start, or else set the executable bit on the init script with chmod a+x /etc/init.d/unicorn_myapp. None of this is Ubuntu-specific stuff, though.

share|improve this answer
Thanks! When I've tried sudo /etc/init.d/unicorn_myapp start [sudo] password for deployer: mypass sudo: /etc/init.d/unicorn_myapp: command not found I'll try to change mode in some minutes. – ANATHEM Aug 9 '12 at 8:21
With chmod anyway -bash: /etc/init.d/unicorn_turbostartum: Permission denied :( – ANATHEM Aug 9 '12 at 8:27
So chmod that, too. – womble Aug 9 '12 at 8:29
Thanks to you and Chris McCauley! With chmod a+x /home/deployer/apps/myapp/current/config/ it works now :) – ANATHEM Aug 9 '12 at 9:53

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.