Thin permissions in etc folder (Ubuntu)
- by Apollo
I am working on a RoR server setup that uses Thin and Nginx.
It works fine, but only if I manually add the folder /etc/thin and set the permissions to 777 in order to use the command below:
thin config -C /etc/thin/testapp.yml -c /var/www/testapp --servers 1 -e production
If I don't set it to 777, I get this error:
me@UbuntuRails:/etc$ thin config -C /etc/thin/testapp.yml -c /var/www/testapp --servers 1 -e production
/usr/local/rvm/gems/ruby-1.9.3-p286@rails328/gems/thin-1.5.0/lib/thin/controllers/controller.rb:115:in initialize': Permission denied - /etc/thin/testapp.yml (Errno::EACCES)
from /usr/local/rvm/gems/ruby-1.9.3-p286@rails328/gems/thin-1.5.0/lib/thin/controllers/controller.rb:115:inopen'
from /usr/local/rvm/gems/ruby-1.9.3-p286@rails328/gems/thin-1.5.0/lib/thin/controllers/controller.rb:115:in config'
from /usr/local/rvm/gems/ruby-1.9.3-p286@rails328/gems/thin-1.5.0/lib/thin/runner.rb:187:inrun_command'
from /usr/local/rvm/gems/ruby-1.9.3-p286@rails328/gems/thin-1.5.0/lib/thin/runner.rb:152:in run!'
from /usr/local/rvm/gems/ruby-1.9.3-p286@rails328/gems/thin-1.5.0/bin/thin:6:in'
from /usr/local/rvm/gems/ruby-1.9.3-p286@rails328/bin/thin:19:in load'
from /usr/local/rvm/gems/ruby-1.9.3-p286@rails328/bin/thin:19:in'
from /usr/local/rvm/gems/ruby-1.9.3-p286@rails328/bin/ruby_noexec_wrapper:14:in eval'
from /usr/local/rvm/gems/ruby-1.9.3-p286@rails328/bin/ruby_noexec_wrapper:14:in'
I don't like to set this folder to a 777, sounds like a rubbish workaround.
I run everything from an admin user account, not root. RVM runs from my admin user and gem only works in my admin as well. If I sudo that action, nothing happens because my root doesn't "know" thin.
Which is the correct way to handle this?
Thanks!