Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 22nd, 2008, 12:10 PM   #1
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 330
Rep Power: 3 kruptof is on a distinguished road
Upload Permissions

I am currently working on a project which requires the upload of files to a specific directory. It seems the only way to upload the file is to chmod the directory to 777. My question is what is the danger associated with doing that, surely having a directory that the whole world can write to is bad right? And if this approach is bad then what other ways exists to upload the files.
__________________
Quote:
When I was young it seemed that life was so wonderful,a miracle, oh it was beautiful, magical.
Now watch what you say or they'll be calling you a radical,a liberal, oh fanatical, criminal. Oh won't you sign up your name,we'd like to feel you're acceptable, respectable, oh presentable, a vegetable
kruptof is offline   Reply With Quote
Old Jan 22nd, 2008, 12:19 PM   #2
titaniumdecoy
Expert Programmer
 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Posts: 856
Rep Power: 3 titaniumdecoy is on a distinguished road
Send a message via AIM to titaniumdecoy
Re: Upload Permissions

A common approach is to use a directory with permissions set to 777 below your web root directory (eg, if your web root is /public_html/, you might use /uploads/).
titaniumdecoy is offline   Reply With Quote
Old Jan 22nd, 2008, 12:29 PM   #3
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 330
Rep Power: 3 kruptof is on a distinguished road
Re: Upload Permissions

Quote:
Originally Posted by titaniumdecoy View Post
A common approach is to use a directory with permissions set to 777 below your web root directory (eg, if your web root is /public_html/, you might use /uploads/).
How can apache serve the files then, I thought it was only allowed to serve anything within or below the document root?
__________________
Quote:
When I was young it seemed that life was so wonderful,a miracle, oh it was beautiful, magical.
Now watch what you say or they'll be calling you a radical,a liberal, oh fanatical, criminal. Oh won't you sign up your name,we'd like to feel you're acceptable, respectable, oh presentable, a vegetable
kruptof is offline   Reply With Quote
Old Jan 22nd, 2008, 3:40 PM   #4
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,886
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
Re: Upload Permissions

You shouldn't have needed to do that. Make sure the username you are using is the privileged owner of the directory, when you're FTPing the files over.

Quote:
Originally Posted by kruptof View Post
How can apache serve the files then, I thought it was only allowed to serve anything within or below the document root?
I'm assuming you mean 'above'. And yes, but it's also circumstantial upon how your service has configured Apache.
Sane is offline   Reply With Quote
Old Jan 22nd, 2008, 3:44 PM   #5
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 330
Rep Power: 3 kruptof is on a distinguished road
Re: Upload Permissions

I am not using an FTP client Sane. I am uploading them using a HTML Form
__________________
Quote:
When I was young it seemed that life was so wonderful,a miracle, oh it was beautiful, magical.
Now watch what you say or they'll be calling you a radical,a liberal, oh fanatical, criminal. Oh won't you sign up your name,we'd like to feel you're acceptable, respectable, oh presentable, a vegetable
kruptof is offline   Reply With Quote
Old Jan 22nd, 2008, 3:50 PM   #6
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 1,886
Rep Power: 5 Sane will become famous soon enough
Send a message via MSN to Sane
Re: Upload Permissions

Oh, and you've written a PHP uploader to handle the upload and save it to the current directory? Maybe you should focus on the root of the problem here: the uploader.

Is the owner of the .php script the same as the owner of the directory? I'm not exactly sure how it works, but I assume if the .php script is not the owner of the directory, then it can't write to the directory (unless it's 777).
Sane is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

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

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
winsock troubles w/ upload file c0ldshadow C++ 2 Feb 3rd, 2006 9:00 PM
Upload Picture yip_kw_trowa PHP 3 Oct 14th, 2005 8:36 AM
Upload file without using <INPUT TYPE="FILE"> bennyz12 HTML / XHTML / CSS 8 Aug 31st, 2005 3:59 PM
Upload a file by getting the file form drive bennyz12 ASP 1 Jul 29th, 2005 8:46 PM
Help with the file upload control Lipo HTML / XHTML / CSS 3 May 2nd, 2005 11:32 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:24 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC