I have a PHP web-app that lists files on a server using ssh. I want the browser/user to be able to download those files. The Apache ID www-data does not have access to the files/folders. The PHP code will use ssh to ls the files for displaying on the browser.
Now I am trying to figure out how to make it so the browser/user can download the files.
I know one way is to have PHP scp the file to a "local" folder that www-data can read so that it can then let the browser/user download the file. I want to avoid this -- I do not want any intermediary transfers.
So I'm wondering if there is another way. I had one idea of creating a file transfer stream using scp where the target is into a PHP something that then sends to the browser. But I don't know if this is possible or if it even makes sense.
user goes to site via web browser -> www-data makes an ssh call to server and lss files -> user clicks on a file to download -> Apache/PHP does something using ssh/scp so that it goes back to the user's browser for download