UK WEB HOSTING FORUM FOR DISCUSSION ON WEB HOSTING SERVICE AND SUPPORT
LINUX HOSTING WINDOWS HOSTING PACKAGES SHOPPING CART OSCOMMERCE ZEN CART AGORA
ECOMMERCE HOSTING ASP MSSQL FRONTPAGE HOSTING PHP MYSQL HOSTING DISCUSSION FORUM
CPANEL RESELLER HOSTING DEDICATED SERVER VPS HOSTING PLESK VIRTUOZZO
Quick Search
Your forum announcement here!

  UK Web Hosting | Dedicated Server Windows and Linux VPS Forum > Technical Support > Control Panel Questions

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-07-2006, 22:36
Junior Member
 
Join Date: Jul 2006
Posts: 4
Default Simple CGI Wrapper for subdomain

eUKhost hosting comes with the simple cgi wrapper which enables cgi scripts to run under the user id, rather than as the webserver. However, when activated in the control panel this creates a scgi-bin directory in the root public_html directory only. Is there any way to set the wrapper up for a subdomain (i.e. create public_html/sub_domain/scgi-bin)? Obviously it's possible to simply place the few scripts requiring such rights in the root scgi-bin folder even for subdomains, but I'd prefer not to have files from different subdomains mixed together if at all possible.

Thanks,

Enigma
Reply With Quote
  #2 (permalink)  
Old 06-07-2006, 08:55
eUKhost.com's Avatar
Chief Marketing Officer
 
Join Date: Sep 2005
Posts: 4,302
Send a message via AIM to eUKhost.com Send a message via MSN to eUKhost.com
Default

When you add a subdomain from control panel, a cgi-bin is created by default in directory of that subdomain. You can put your scripts for respective subdomain name in that particular cgi-bin.
Reply With Quote
  #3 (permalink)  
Old 06-07-2006, 10:43
Junior Member
 
Join Date: Jul 2006
Posts: 4
Default

Thanks for your reply.

The problem is that scripts placed in the subdomain's cgi-bin are run by the webserver under its own user id (user: nobody). Since this is different from the user id of the owner of the website and in a different group if any of the scripts need to write to the filesystem the directories written to must be world writable. The simple CGI wrapper wraps scripts so that they run under the user id of the website owner, not of the webserver. This way directories that are written to need only be user writable, not world writable.
Reply With Quote
  #4 (permalink)  
Old 06-07-2006, 11:42
eUKhost.com's Avatar
Chief Marketing Officer
 
Join Date: Sep 2005
Posts: 4,302
Send a message via AIM to eUKhost.com Send a message via MSN to eUKhost.com
Default

Scripts that you upload remain under your ownership but the scripts generated by some other script in your account is generated under ownership of nobody. If you have problems with the ownership of nobody then you should contact our helpdesk immediately to get your ownership on those scripts as ownership of nobody and permission 777 is open invitation to hackers / crackers to play and modify contents of those scripts.
__________________
UK Web Hosting || Business Hosting || eUKhost Knowledgebase
Toll Free : 0808 262 0255 || MSN : mark @ eukhost.com || AIM : eukmark
A bunch of Sheep led by a Lion is better than a bunch of Lions led by a Sheep.
__________________________________________________

Great Opportunity :: Join our Affiliate Program for FREE and earn 20% commission on each referral.
Reply With Quote
  #5 (permalink)  
Old 06-07-2006, 12:11
Junior Member
 
Join Date: Jul 2006
Posts: 4
Default

I don't think you're quite understanding my issue.

Suppose we have the following website directory structure (with unix permissions shown):
Code:
[d] 755 website/
[d] 755         public_html/
[d] 755                     cgi-bin/
[f] 755                            root-domain-script.cgi
[d] 755                     scgi-bin/
[f] 755                              root-domain-wrapped-script.cgi
[d] 755                     subdomain/
[d] 755                               cgi-bin/
[f] 755                                       subdomain-script.cgi
[d] 755                               safe-user-writable-folder/
[d] 777                               unsafe-world-writable-folder/
And the cgi scripts are identical perl scripts containing the following code (forgive me if the perl is incorrect - I'm not that experienced with it - but the intent should be clear):
Code:
#!/usr/bin/perl -w

open(SAFEFILE, ">", "/website/public_html/subdomain/safe-user-writable-folder/temp");
open(UNSAFEFILE, ">", "/website/public_html/subdomain/unsafe-world-writable-folder/temp");

while (read (STDIN, $LINE, 4096))
{
	if (SAFEFILE)
	{
		print SAFEFILE $LINE;
	}
	if (UNSAFEFILE)
	{
		print UNSAFEFILE $LINE;
	}
}
close (SAFEFILE);
close (UNSAFEFILE);

exit(0);
Now root-domain-script.cgi will successfully create the file /website/public_html/subdomain/unsafe-world-writable-folder/temp, but will fail to create the file /website/public_html/subdomain/safe-user-writable-folder/temp. This is because scripts, regardless of who owns the script file, are run by the webserver and therefore are run by default with the webservers user id, which is "nobody" and "nobody" does not have permission to write to the folder safe-user-writable-folder.

This situation is exactly the same for subdomain-script.cgi.

root-domain-wrapped-script.cgi however will run not with the webserver user id but with the script owner's user id, thanks to simple CGI wrapper, and will therefore successfully create both files.

What I would like is to be able to have a directory structure like:
Code:
[d] 755 website/
[d] 755         public_html/
[d] 755                     cgi-bin/
[f] 755                            root-domain-script.cgi
[d] 755                     scgi-bin/
[f] 755                              root-domain-wrapped-script.cgi
[d] 755                     subdomain/
[d] 755                               cgi-bin/
[f] 755                                       subdomain-script.cgi
[d] 755                               scgi-bin/
[f] 755                                        subdomain-wrapped-script.cgi
[d] 755                               safe-user-writable-folder/
With the additional scgi-bin directory and subdomain-wrapped-script.cgi in the subdomain folder.
Reply With Quote
  #6 (permalink)  
Old 06-07-2006, 16:23
Junior Member
 
Join Date: Jul 2006
Posts: 4
Default

Strangely my script seems to be working now even when I move it out of the scgi-bin directory, which I can't explain.
Reply With Quote
  #7 (permalink)  
Old 06-07-2006, 20:28
eUKhost.com's Avatar
Chief Marketing Officer
 
Join Date: Sep 2005
Posts: 4,302
Send a message via AIM to eUKhost.com Send a message via MSN to eUKhost.com
Default

Probablly you have code in your .htaccess to allow cgi scripts to execute outside cgi-bin. If you wish to execute cgi scripts outside cgi-bin then you add following code to your .htaccess :-

Options +ExecCGI
AddHandler cgi-script cgi pl
__________________
UK Web Hosting || Business Hosting || eUKhost Knowledgebase
Toll Free : 0808 262 0255 || MSN : mark @ eukhost.com || AIM : eukmark
A bunch of Sheep led by a Lion is better than a bunch of Lions led by a Sheep.
__________________________________________________

Great Opportunity :: Join our Affiliate Program for FREE and earn 20% commission on each referral.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:11.

 

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by Web Hosting 3.1.0
Copyright © 2001-2008, eUKhost.com. All rights reserved.

 
Site Map

VPS Hosting
VPS Hosting plans

Dedicated Server Hosting
Dedicated Server plans

Business Web Hosting
100% uptime Hosting

Cpanel Hosting
cPanel Shared Hosting

Reseller Hosting
Reseller Web Hosting

Windows Hosting
Windows Shared Hosting

Windows VPS

Windows VPS Hosting

Semi Dedicated Servers
Semi-Dedicated Hosting

Dedicated Server Mirroring
Dedicated Server Mirroring

Webhosting Knowledgebase
Frequently asked Questions

Web Hosting Blog
eUKhost Blog

Web Hosting Support
Support Helpdesk

UK Data Center
eUKhost Datacenter

Web Hosting Forum
eUKhost Forum

Support Tutorials
Online Flash Tutorials

Offsite Back-up Plans
Remote Backup Service

Customer Testimonials
eUK Customer Testimonials


knowledgebase articles

eUKhost.com Services

Pre-Sales Questions
Pre-sales FAQ's

Domain Names
Domain registration FAQ's

cPanel Hosting
cPanel Hosting FAQ's

Windows Web Hosting
Plesk Control Panel

Reseller Hosting
Reseller Hosting FAQ's

VPS Hosting
Virtual Private Server

Semi-Dedicated Servers
Semi-Dedicated FAQ's

Dedicated Servers
Dedicated Server Hosting


popular blog categories


Web Hosting
Website Hosting articles

UK Web Hosting
UK Hosting articles

Dedicated Server Hosting
Dedicated Server guidelines

VPS Hosting
VPS hosting articles

cPanel Hosting
cPanel Hosting articles

Linux Operating System
Linux Operating techniques

Windows Web Hosting
Windows plesk articles