473,396 Members | 1,779 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,396 software developers and data experts.

mkdir permission issue

B
Hi,

I am using mkdir to create a directory and upload files to it.
Unfortunately the folder is accessible via the url to any user, which
is creating problems. How can I manage permissions with mkdir so the
folder is not availabe via the url path

thanks :)
Jan 22 '08 #1
1 1878
On Jan 22, 6:47 am, B <bilalallaw...@gmail.comwrote:
Hi,

I am using mkdir to create a directory and upload files to it.
Unfortunately the folder is accessible via the url to any user, which
is creating problems. How can I manage permissions with mkdir so the
folder is not availabe via the url path

thanks :)
Lots of options, here are a couple:

1. why not make the folder outside the webroot?

for example, if your webroot maps to /home/joebloggs/mywebsite on
your server, instead of making the directory under (e.g. /home/
joebloggs/mywebsite/myuploadir), put outside the webroot (e.g. /home/
joebloggs/myuploadir). PHP will still be able to get the files but
they will no longer be accesible via a URL.

You'll probably need to modify the file permissions of the parent
directory to ensure your script can create the upload directory in the
new location.

2. When you create the directory, also create a small .htaccess file
in the same directory with contents something like this:

<Directory "/home/joebloggs/mywebsite/myuploadir">
<FilesMatch ".doc|.gif">
Deny from all
</FilesMatch>
</Directory>

Jan 22 '08 #2

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

Similar topics

7
by: fingermark | last post by:
i have the make.php located on my server. the only line of code is mkdir("/home/foouser/public_html/newdir", 0755);. now /home/foouser/public_html is "drwxr-xr-x 7 foouser foouser". with just...
6
by: Ernesto | last post by:
I couldn't find this with a search, but isn't there a way to overwrite a previous folder (or at least not perform osmkdir( ) if your program detects it already exists). Thanks !
1
by: joelbyrd | last post by:
I'm trying to do a mkdir(), but I'm getting permission denied error, even though I've set the mode to 0777: mkdir($full_path, 0777). I also couldn't do a chmod successfully. The code is...
5
by: eoindeb | last post by:
I am trying to create a directory on Solaris using the mkdir() function. This works fine when I pass a string literal ("/etc/hosts") to mkdir, but if I try passing a directory pointer to mkdir, it...
30
by: MikeC | last post by:
Good People, I'm writing a backup utility that uses a chdir() to go into the source directory (in which the files reside that I want to back up), so I don't want to use chdir() to get into the...
10
Mague
by: Mague | last post by:
Hey, I am using a server of my friends, and i created a directory through php with exec("mkdir $dir") these are now imposible to get into and delete. (well not impsobile, impossible for a kid my...
4
by: John | last post by:
Hi The following does not create a directory neither does it give any error message. Any ideas? $umask=umask(0); $where="/var/www/vhosts/example.com/httpdocs/friday/"; mkdir ($where,0777);...
3
by: fouadk | last post by:
hi everyone.... i am trying to create a folder in my home directory but that ain't working due to permission restriction my code looks like the following: <?php $path =...
2
by: ezechiel | last post by:
Hi, I'm working on windows here.. i have a script that makes directories, subdirs (mkdir) and I afterwards set special permissions with xcacls trough a system call. But when I took a closer...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.