wa0x6e / Cake-Resque

Resque plugin for CakePHP : for creating background jobs that can be processed offline later
MIT License
159 stars 56 forks source link

Requiring sudo by default leads to problems on default linux systems (eg debian) #33

Closed andreasklinger closed 10 years ago

andreasklinger commented 10 years ago

In CakeResqueShell:

 sprintf("nohup sudo -u %s \\\n", $this->_runtime['user']),

Calling sudo - even to sudo as one-self - requires to be part of a /etc/sudoers list.

Most users which are made to run tasks aren't in that list.

Suggested change: If the target user is the same user as the one who runs the shell. Don't use sudo.

If you find this issue through google: A workaround for this problem is to run this as root

chmod u+w /etc/sudoers
echo "YOUR_TASK_USER ALL=(YOUR_TASK_USER) NOPASSWD: ALL" >> /etc/sudoers
chmod u-w /etc/sudoers
wa0x6e commented 10 years ago

Just for information, what is your config ?

You're logged into the shell as user A (who's not in the sudoers list), and want to execute a task as another user B ? In your case, the user B is the one running the webserver (www-data) ?

andreasklinger commented 10 years ago

Basically every debian squeeze default setup should do

In our case web/worker runs as "vagrant"

To recreate the setup: Download Vagrant & VirtualBox Here are our setup script (simplified) https://gist.github.com/andreasklinger/7150656

wa0x6e commented 10 years ago

I can implement the "If the target user is the same user as the one who runs the shell. Don't use sudo" part.

wa0x6e commented 10 years ago

Implemented in the latest release

andreasklinger commented 10 years ago

thx mate.