I run an Ubuntu 10.04 VPS which hosts 2 Thin processes running Ruby On Rails behind Nginx. I control the Thin processes via a /etc/init.d startup script as a regular user. In my Thin config file I specify:
user: www-data
group: www-data
And in my Thin logs, when I start the server, I see
>> Changing process privilege to www-data:www-data
Good sign. Problem is when I run ps -ef
my Thin processes are running as the user I login as — the user I run /etc/init.d/thin start
as.
How can I get the Thin processes started as www-data:www-data when I run /etc/init.d/thin start
as the user I log into the server as?
Best Answer
You can use sudo to run a command as any user:group with these options:
-u sets the www-data user and -g sets the www-data group