LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > PHP > Permissions on PHP file uploads are a little weird.

Reply
 
Thread Tools Display Modes
  #1  
Old 02-25-2008, 01:29 PM
brettdavidsonnz brettdavidsonnz is offline
Member
 
Join Date: Nov 2007
Location: New Zealand
Posts: 27
Question Permissions on PHP file uploads are a little weird.

Using a very basic forms/move_uploaded_file script to upload files to a host.

The host is loaded via the apache httpd.conf and is set to use suexec as a particular user:group. (Server is FreeBSD 6.3).

Files created with fwrite have correct user:group permissions but files uploaded with move_uploaded_file do not. They get the owner:group permissions of the backend lsws process.

Is this a known issue or am I doing something wrong?
Reply With Quote
  #2  
Old 02-25-2008, 05:13 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
Please check the user id of lsphp processes. Please remove the old file and test again. if the file exist, the ownership will not be changed if upload again.
Reply With Quote
  #3  
Old 02-25-2008, 05:50 PM
brettdavidsonnz brettdavidsonnz is offline
Member
 
Join Date: Nov 2007
Location: New Zealand
Posts: 27
lsphp5 ownership is www so that will explain this issue.

Now then, if PHPsuEXEC is enabled and docroot UID is set, why would the process be owned by www?

Ownership when creating files works by (I assume) deciding this based on the directory ownership.
Reply With Quote
  #4  
Old 02-25-2008, 05:56 PM
brettdavidsonnz brettdavidsonnz is offline
Member
 
Join Date: Nov 2007
Location: New Zealand
Posts: 27
As a further note, the apache httpd.conf is loaded in via lsws' httpd_config.xml file. The systems uses Plesk.
This httpd.conf file in turn loads some includes (plesk.include) which then include a file for each domain (a httpd.include file within each domain).
The suexecUserGroup directive is set in these httpd.include files.

The system control panel shows the APVH virtual host entry and APVH listeners running. Does PHPsuEXEC only work with Litespeed listeners?
Reply With Quote
  #5  
Old 02-25-2008, 06:28 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
can you PM me the login to LSWS admin console?
Reply With Quote
  #6  
Old 02-25-2008, 07:15 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
I checked the server, it does use suexec for that vhost.
Can you please double check the suexecUserGroup configuration for that vhost. the user does exist.
And, you can send us your http.conf and included configuration file for analysis to bug @ litespeedtech ...
Reply With Quote
  #7  
Old 02-25-2008, 07:53 PM
brettdavidsonnz brettdavidsonnz is offline
Member
 
Join Date: Nov 2007
Location: New Zealand
Posts: 27
Default Done.

These have been emailed to the address you listed.
Reply With Quote
  #8  
Old 02-25-2008, 08:16 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
One more question, does the server installed with "root" user? suExec only works when the user who run LSWS installer is "root". if you run the installer as "www" user, suexec will not work.
Reply With Quote
  #9  
Old 02-26-2008, 11:40 AM
brettdavidsonnz brettdavidsonnz is offline
Member
 
Join Date: Nov 2007
Location: New Zealand
Posts: 27
Yes. System installed as root but runs as www.

ps shows :

root 17697 0.0 0.1 5188 4240 ?? S 4:28PM 0:42.42 lshttpd (lshttpd.3.3.4)
root 17698 0.0 0.0 1296 692 ?? S 4:28PM 0:00.48 lscgid (lscgid.3.3.4)
www 17699 0.0 0.1 5156 4240 ?? S 4:28PM 0:33.41 lshttpd (lshttpd.3.3.4)
www 17700 0.0 0.1 5156 4236 ?? S 4:28PM 0:33.27 lshttpd (lshttpd.3.3.4)
Reply With Quote
  #10  
Old 02-26-2008, 11:49 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,603
Can you please check the ownership and permission mask of lsws/bin/lscgid,
It should be owned by root with setuid bit set. suEXEC rely on it.
Reply With Quote
Reply

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:19 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.