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

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Bug Reports > Chmod is broken with Litespeed

Reply
 
Thread Tools Display Modes
  #1  
Old 04-30-2010, 04:14 PM
Jedis Jedis is offline
New Member
 
Join Date: Apr 2010
Posts: 8
Default Chmod is broken with Litespeed

My host is telling me that chmod does not work correctly with Litespeed. Is this true?

I want my directories to be chmod 750 to prevent directory listing. They told me to use htaccess to prevent directory listing, but I don't want this global for my account and do not want to have to create an htaccess for each directory I want directory listing turned on.

The exact quote from them is the following:

"If you chmod your directories, you'll get a 404 error, not a permission error. It's the way litespeed is designed."

Someone please help! I chmod'd to 750 in the shell and directory listing is still working if I navigate there with a browser.

Any help is greatly appreciated, thank you!
Reply With Quote
  #2  
Old 05-01-2010, 02:27 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
my test: if chmod 750 path/to/mydir
Code:
[ERROR] Can not open directory for URI: path/to/mydir
>I chmod'd to 750 in the shell and directory listing is still working if I navigate there with a browser.

litespeed use lsws/share/autoindex/default.php to generate directory index.
so check if the user/group of lsphp and user/group of the directory matches.

for example, if lsphp run as nobody/nobody, and the directory's user/group also nobody/nobody, even if the directory's permission is set to 700, directory listing still working. in this case, change directory's user/group to jedis/jedis(for example) and set permission to 750, will prevent the directory listing.
Reply With Quote
  #3  
Old 05-01-2010, 05:25 AM
Jedis Jedis is offline
New Member
 
Join Date: Apr 2010
Posts: 8
Hi NiteWave,

Thanks for the response. I will do my best to answer your questions.

I can perform the chmod to the directory and do not get an error, but can still pull a directory list by navigating to that directory via a web browser. Litespeed seems to completely ignore the chmod, as if I never performed it, at least as far as chmod 750 is concerned.

My home folder permissions are set to myusername/myusername. I cannot seem to find the lsws directory in my jailed shell to check the permissions. It is not in /usr/local.

Is there anything else I can check on my end? Should I direct my host to this thread to read your response?

Any additional help you can provide would be greatly appreciated.

Thank you!
Reply With Quote
  #4  
Old 05-01-2010, 05:33 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
>Is there anything else I can check on my end?

#ps -ef|grep lsphp
Reply With Quote
  #5  
Old 05-01-2010, 05:35 AM
Jedis Jedis is offline
New Member
 
Join Date: Apr 2010
Posts: 8
654 11237 10958 8 07:35 ? 00:00:01 lsphp5
654 12428 10958 6 07:35 ? 00:00:00 lsphp5
599 12434 10958 0 07:35 ? 00:00:00 lsphp5
myusername 12454 8309 0 07:35 ? 00:00:00 grep lsphp
Reply With Quote
  #6  
Old 05-01-2010, 08:45 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
got to understand your situation.

your php run in suEXEC mode, which has same uid/gid as your home folder.

so auto directory indexing happens on a folder which has least 500 permission, include 750. unless you set the directory's permission to 000.

there is a possible way to implement your requirement: customize your own autoindex script. when directory permission is 750, then the script won't index.

there is a wiki page regarding customizing auto index script:
http://www.litespeedtech.com/support...wiki:autoindex

also please refer this forum thread:
http://www.litespeedtech.com/support...ight=autoindex
Reply With Quote
  #7  
Old 05-03-2010, 11:08 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,585
Just turn off directory indexing at the document root directory via .htaccess, all sub directories will be off by default.
Reply With Quote
  #8  
Old 05-06-2010, 11:54 AM
Jedis Jedis is offline
New Member
 
Join Date: Apr 2010
Posts: 8
Quote:
Originally Posted by mistwang View Post
Just turn off directory indexing at the document root directory via .htaccess, all sub directories will be off by default.
Quote:
Originally Posted by Jedis View Post
They told me to use htaccess to prevent directory listing, but I don't want this global for my account and do not want to have to create an htaccess for each directory I want directory listing turned on.
See above. I don't want a global .htaccess file.

Chmod really should be made to work correctly with LiteSpeed, like how it does with Apache. I was frustrated enough, I almost had them move me to a server that didn't have LiteSpeed and just had regular old Apache.
Reply With Quote
  #9  
Old 05-07-2010, 04:56 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
please try:
1. copy the default.php to your home folder
Code:
cp /usr/local/lsws/share/autoindex/default.php /home/myusername/test/myindex.php
2.edit .htaccess in your document root -- assume it's ~/public_html/.htaccess
add one line:
Code:
alias /_autoindex/default.php /home/myusername/test/myindex.php
3.edit /home/myusername/test/myindex.php
change:
Code:
function readDirList( $path, &$excludes, &$map )
{
        $handle = opendir( $path );
to
Code:
function readDirList( $path, &$excludes, &$map )
{
        $perms = fileperms($path);
        if(($perms & 0x0004)==0)
        {
                return null;
        }
        $handle = opendir( $path );
Has tested above code sample at my local lsws. Please share with us if it works at your end as well.
Reply With Quote
  #10  
Old 05-10-2010, 09:47 AM
Jedis Jedis is offline
New Member
 
Join Date: Apr 2010
Posts: 8
Quote:
Originally Posted by NiteWave View Post
please try:
1. copy the default.php to your home folder
Code:
cp /usr/local/lsws/share/autoindex/default.php /home/myusername/test/myindex.php
I can't find that file in my jailed shell. Is it available online somewhere so I can get a copy of default.php?

Thanks!
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 08:13 AM.



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