• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • Last Modified:

Make user download a file placed outside public_html

Hi,

Is there a way to allow a user to download a file placed outside of the public_html folder?
ex. /home/username/filename.zip
0
kgp43
Asked:
kgp43
  • 3
  • 2
1 Solution
 
yuzhCommented:
You can use  symbolic links, eg, put all the files in:
/home/username/download

then do:
ln -s /home/username/download /home/username/public_html/download

and make sure that apache user has "rx" permission to /home/username/download
dir.
0
 
kgp43Author Commented:
isnt ln -s /.... a ssh command?
how can I do that with php?
0
 
yuzhCommented:
ln -s source tagart

is a shell command, you need to do it in the shell prompt.

Don't use  php for the job, php script run as user nobody, you need
to do system call to run it as supper user, it is a security risk!
0
 
kgp43Author Commented:
need it for my visitors.

I had problems with my hotlink protection and that question found a solution on this problem.
http://www.experts-exchange.com/Web/Web_Servers/Apache/Q_21416514.html

What do you do with this question then?
0
 
yuzhCommented:
Not sure which question are you talking about. for http:Q_21416514.html 
It is a lot easier to put the files you want to control acces in one dir, and make
the dir only allow certain machines (IP range) can access to Or just simply use password
login to protect the files in that dir.


see:
http://httpd.apache.org/docs-2.0/howto/auth.html

for more details also read the apache doc about .htaccess file

Have a nice weekend, cheers!
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now