bamnet

Member
Feb 7, 2005
15
0
151
I'm working on creating a plugin to replace the Ruby on Rails interface included in CPanel with my own simplified version developed for Passenger/mod_rails.

I'm wondering what the best way to get a plugin to write/create a file like /usr/local/apache/conf/userdata/std/2/username/domain/rails.conf is? I've tried just having my php script use mkdir (since the directory structure doesn't exist for all users) and fopen but since the script runs as the user it doesn't have permission to do any writing.
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
I'm working on creating a plugin to replace the Ruby on Rails interface included in CPanel with my own simplified version developed for Passenger/mod_rails.

I'm wondering what the best way to get a plugin to write/create a file like /usr/local/apache/conf/userdata/std/2/username/domain/rails.conf is? I've tried just having my php script use mkdir (since the directory structure doesn't exist for all users) and fopen but since the script runs as the user it doesn't have permission to do any writing.
The safest way to implement this may be with setuid files that run with authentication and allow only the operations that need to be performed.

There are many different ways to go about this implementation - but the underlaying fact from a cPanel plug-in perspective is that anything in the cPanel interface is running as that user, not root.