Link to home
Start Free TrialLog in
Avatar of kgp43
kgp43Flag for Denmark

asked on

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
Avatar of yuzh
yuzh

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.
Avatar of kgp43

ASKER

isnt ln -s /.... a ssh command?
how can I do that with php?
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!
Avatar of kgp43

ASKER

need it for my visitors.

I had problems with my hotlink protection and that question found a solution on this problem.
https://www.experts-exchange.com/questions/21416514/Deny-access-to-files-files-except-if-the-user-is-coming-from-a-specific-page.html

What do you do with this question then?
ASKER CERTIFIED SOLUTION
Avatar of yuzh
yuzh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial