473,404 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

PHP file access and directory security

JW
I have a directory protected with .htaccess / .htpasswd. After I'm validated, I
run a php script which bombs out when trying to write a file to that directory.
If I chmod 777 on the directory (default was 755) then everything works ok.

So apparently, the script is running under a different security context even
though it's being run via my http session validated via .htaccess.

1) Do I have to be concerned about access to a protected directory via .htaccess
but with wide-open file permissions?
2) If yes, are there any alternatives for my PHP routines if I want to maintain
file-level permissions?
3) Is this normal behavior (i.e., how things are supposed to work with
file-level access) for most ISPs?

Thanks -

jon

--
jwayne@_myrealbox_no_spam.com
Jul 16 '05 #1
2 11030
JW <jwayne@_myrealbox_no_spam.com> wrote in message news:<6f********************************@4ax.com>. ..
I have a directory protected with .htaccess / .htpasswd. After I'm validated, I
run a php script which bombs out when trying to write a file to that directory.
If I chmod 777 on the directory (default was 755) then everything works ok.

So apparently, the script is running under a different security context even
though it's being run via my http session validated via .htaccess.

1) Do I have to be concerned about access to a protected directory via .htaccess
but with wide-open file permissions?
2) If yes, are there any alternatives for my PHP routines if I want to maintain
file-level permissions?
3) Is this normal behavior (i.e., how things are supposed to work with
file-level access) for most ISPs?

Thanks -

jon


..htaccess configures only http-access to your directory. file-writing
under php works without http, so .htaccess does't apply.

micha
Jul 16 '05 #2
JW
ch*********@web.de (chotiwallah) wrote:
JW <jwayne@_myrealbox_no_spam.com> wrote in message news:<6f********************************@4ax.com>. ..
I have a directory protected with .htaccess / .htpasswd. After I'm validated, I
run a php script which bombs out when trying to write a file to that directory.
If I chmod 777 on the directory (default was 755) then everything works ok.

So apparently, the script is running under a different security context even
though it's being run via my http session validated via .htaccess.

1) Do I have to be concerned about access to a protected directory via .htaccess
but with wide-open file permissions?
2) If yes, are there any alternatives for my PHP routines if I want to maintain
file-level permissions?
3) Is this normal behavior (i.e., how things are supposed to work with
file-level access) for most ISPs?

Thanks -

jon


.htaccess configures only http-access to your directory. file-writing
under php works without http, so .htaccess does't apply.


Yeah, figured that out already. I was wondering whether I had to be concerned
about 777 file permissions if http was protected via .htaccess. I.e., can it be
accessed by other means? And if I do need to be concerned, what are my
alternatives? I neglected to mention that only _I_ (the owner of the directory
and the script) need to write those files. The ISP uses suEXEC and safe_mode is
turned off.

For now, I have 755 on the directory and have only the files that I need to
write set to 777.

jon

--
jwayne@_myrealbox_no_spam.com
Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Dave Smithz | last post by:
Hi There, I have a PHP script that sends an email with attachment and works great when provided the path to the file to send. However this file needs to be on the same server as the script. ...
8
by: Paul | last post by:
Hello, I've been reading up on security in Java Applets and whilst I understand the concept, I can't successfully get my applet to read a file on my local machine. I discovered from...
0
by: Fran Tirimo | last post by:
I am developing a small website using ASP scripts to format data retrieved from an Access database. It will run on a Windows 2003 server supporting FrontPage extensions 2002 hosted by the company...
2
by: Fran Tirimo | last post by:
I am developing a small website using ASP scripts to format data retrieved from an Access database. It will run on a Windows 2003 server supporting FrontPage extensions 2002 hosted by the company...
18
by: Dan | last post by:
I have code like the following to test for existence of a file. I know the file is there, but File.Exists returns FALSE. The problem appears to be that the file is in a directory beneath "My...
3
by: David Thielen | last post by:
Hi; I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But when it tries to write a file I get: Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images ...
15
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. ...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
16
by: Mich | last post by:
Hi, i'm building an web application for anonymous users. They can take a look in the website, nothing more. In order to perform other actions, the anonymous user must be logged. So i create an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.