#1  
Old 17th August 2010, 16:32
Rapid2214 Rapid2214 is offline
Senior Member
 
Join Date: Jun 2010
Posts: 105
Thanks: 3
Thanked 5 Times in 5 Posts
Default PHP Permission Error

Hi,
I'm trying to write to a .txt file in my web directory, although i'm getting a permission denied error.
I think the problem is that to write to the file it must have www-data permission? Shouldn't it already?
Here is the result of ls -l
Code:
-rw-r--r-- 1 web24 client1 1512 2010-08-17 14:24 index.php
-rw-r--r-- 1 web24 client1    0 2010-08-17 14:17 moss_visits.txt
-rw-r--r-- 1 web24 client1    0 2010-08-17 13:48 roy_visits.txt
-rw-r--r-- 1 web24 client1  412 2010-08-17 14:03 visit.php
Why can't www-data write to moss_visits.txt or roy_visits.txt?
I worried this may effect my clients....

Thanks

Marty

An undesired fix was to redefine the permissions to www-data client1, which was not ideal and prevented FTP access.

Help :S
Reply With Quote
Sponsored Links
  #2  
Old 17th August 2010, 17:18
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

-rw-r--r-- 1 web24 client1 0 2010-08-17 14:17 moss_visits.tx

user web24 may: read, write
group client1 may: read
world (that's www-data as well) may: read

so no, www-data may not write to that file, the solution would be giving the world write rights .. so:
Code:
chmod 666 moss_visits.txt roy_visits.txt
Reply With Quote
  #3  
Old 17th August 2010, 17:40
Rapid2214 Rapid2214 is offline
Senior Member
 
Join Date: Jun 2010
Posts: 105
Thanks: 3
Thanked 5 Times in 5 Posts
Default

Yes, that fine if it's only my website...

How can i give all clients world write permission, i tried chmod 775 -R /var/www

But it took down all the websites with a 403 error.

Any idea?
Marty
Reply With Quote
  #4  
Old 17th August 2010, 19:03
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

tip1: NEVER use "-R" in linux commands if you have no clue what the command does ..

because all your filepermissions are messed up now ..
you don't want all 'clients' world write persmission, that's a huge security risk.
only give world write permissions to files you know it's oke it's going to be written by apache (f.e.) ..
Reply With Quote
  #5  
Old 17th August 2010, 19:24
Rapid2214 Rapid2214 is offline
Senior Member
 
Join Date: Jun 2010
Posts: 105
Thanks: 3
Thanked 5 Times in 5 Posts
Default

I do know what '-R' does, but didn't expect that effect. and btw, i had backups which i restored to, so my permissions arent 'messed up'.

How do big hosting companies like EUKHOST have it then, they must have gobal write?
Reply With Quote
  #6  
Old 17th August 2010, 22:14
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

big hosting companies? well it's basic stuff ..

you log in onto your servers through ftp user/pass ..

user logged in, uploads a file .. automatically it's owner is user and group the group the user is in .. after that, if you want that file to be writable through the webserver, you need to change it's file permissions MANUALLY ..

If i know you are hosting a server with everything world writable, i'd like to hire a hosting package with you and have some fun! .. if you know what i mean ... it's just a "not done" thing.

if you want a file world write then do chmod o+w <file> and you should be fine
Reply With Quote
  #7  
Old 17th August 2010, 22:58
Rapid2214 Rapid2214 is offline
Senior Member
 
Join Date: Jun 2010
Posts: 105
Thanks: 3
Thanked 5 Times in 5 Posts
 
Default

Good Point...

Thanks for the help.

Marty
Reply With Quote
Reply

Bookmarks

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
ISPCONFIG 3 Email Content Filter jariasca Installation/Configuration 11 2nd August 2012 13:27
CP210x USB to UART Bridge Linux VCP Drivers(SILICON Labs) perfectpol7 Kernel Questions 13 9th November 2010 08:30
cyrus-sasl won't install on my ubuntu9.04 kameelperdza Installation/Configuration 1 13th June 2009 11:28
Newly Installed ISPConfig3 on Ubuntu 8.04 : login redirect fail ? cripperz Installation/Configuration 5 22nd March 2009 13:15
Could not make OpenSSL yontengyatso Installation/Configuration 3 3rd November 2005 11:50


All times are GMT +2. The time now is 15:26.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.