cancel
Showing results for 
Search instead for 
Did you mean: 

File permission S ?

sofaville
Newbie
Posts: 8
Registered: ‎08-02-2014

File permission S ?


PHP files I'm loading to my cgi site aren't executing - the browser says they can't be found - however I can see them in Filezilla.
Whatever I set the permission to they still can't be seen by the browser.
I had some php files loaded before the migration and I notice these all have a mysterious extra permission - S - so a file might show -rwx--S---
All the files with an S work but I can't see anyway to set this attribute in Filezilla for my new files.
A bit of Googling seems to indicate this is a setuid flags? However my technical knowledge is pretty low and I can't understand most of the articles.
Can anyone explain in simple terms how I can set this on my new files (or change it so the files don't require it).
6 REPLIES 6
Penny
Superuser
Superuser
Posts: 974
Thanks: 515
Fixes: 5
Registered: ‎05-04-2007

Re: File permission S ?

Quote from: sofaville
PHP files I'm loading to my cgi site aren't executing - the browser says they can't be found - however I can see them in Filezilla.
Can anyone explain in simple terms how I can set this on my new files (or change it so the files don't require it).

Hi sofaville,
stupid question maybe but are the php files in the "public" directory?  I've just checked the ones that were migrated (here) and they all are (in that directory) - all seem to be working with attributes set to 755 (that was what was used previously but have just checked a current one and they're the same).
The only incidences of S markings seem to be on "directories" (folders) in the outer bit that contains only the "provided" directories (ie those provided by the Dublin people) and the .htaccess file.  (The outer bit might be able to hold other stuff maybe but no php files were in the outer bit, in the set-ups provided for the migrated files here.)
I hope that makes sense Smiley
Regards,
Penny.
Penny Rollo * Force 9 from 17/02/98 * PlusNet from 2000 onwards
Project HappyChild - free maths worksheets, free French-English
worksheets and 12 other languages
personal site www.pennymidasrollo.plus.com
spraxyt
Superuser
Superuser
Posts: 10,063
Thanks: 1,369
Fixes: 75
Registered: ‎06-04-2007

Re: File permission S ?

To add to what Penny has just posted.
Are you uploading your PHP files as ascii transfers to /public? PHP files in there should work with the default 644 permissions (-rw-r--r--), or even with 600 (-rw-------). Migrated ones would probably be 700 or 755 (which as Penny said continue to work).
The following file
[code=helloworld.php]
<?php
echo "Hello world!";
?>[/code]
works for me with permissions 644 or 600.
Permissions -rwx--S--- imply the script is setgid, but only superuser can set that. Usually that is set only on directories and it should be on your root directory (/). My /public directory has permissions 755 (though I think it was 775 post migration).
David
David
sofaville
Newbie
Posts: 8
Registered: ‎08-02-2014

Re: File permission S ?

Thanks everyone for your help... although I'm embarassed to admit I discovered what my problem was. My code was pointing at the old cgi domain not the new one - so it was simply an error in the url. The whole File Permission S thing was a red herring.
Penny
Superuser
Superuser
Posts: 974
Thanks: 515
Fixes: 5
Registered: ‎05-04-2007

Re: File permission S ?

.
At least it's sorted, that's the main thing, thanks for the update : )
Penny Rollo * Force 9 from 17/02/98 * PlusNet from 2000 onwards
Project HappyChild - free maths worksheets, free French-English
worksheets and 12 other languages
personal site www.pennymidasrollo.plus.com
Gabe
Community Veteran
Posts: 767
Registered: ‎29-10-2008

Re: File permission S ?

Quote from: spraxyt
Permissions -rwx--S--- imply the script is setgid, but only superuser can set that.

Just as an aside, you don't have to be a su to set sgid, just a member of the relevant group with permission in the containing folder. A wrinkle on the new platform, relative to the old, is that php scripts run with one gid and shell scripts with another. If you use both, then setting sgid on folders can help keep all the gids of files a folders created within them the same, though the mix is only likely to cause issues if you use paranoid permissions. It can be set programmatically, e.g.
chmod($_SERVER['DOCUMENT_ROOT'], 02700);

Gabe
spraxyt
Superuser
Superuser
Posts: 10,063
Thanks: 1,369
Fixes: 75
Registered: ‎06-04-2007

Re: File permission S ?

Thanks for clarifying this.
David
David