title: Need to retrieve file from a remote server in PHP script. Folder restricted to root. Root doesn't have scp access. What can I do?
body: <p>I have a big list of servers. Using a PHP script, I need to get the apache2 access logs from each server. I had originally tested this with a test file and my webuser using SCP and it worked great, but at the time I didn't realize that root can't use SCP by default, so when I switched over to grab the actual files... it failed. </p>
  
  <p>Apache2 logs are protected and can only be accessed by root. This is fine, as I have the credentials. However - I cannot just use SCP with root as root doesn't have access to SCP, and I can't go in and give spc permission to root on each server. I also can't change the log permissions so that my webuser can access it. </p>
  
  <p>Is there some sort of workaround to this? </p>
  
  <p>I've considered using exec to simply ssh into each remote server as root, and use scp in reverse to push back down to my local server - right now I'm working on my local and I don't have a static IP to specify, is there a way to specify the host? Perhaps I could ssh is as root, copy the log files to a temp directory that webuser can access, exit, scp back in as webuser and copy the files down? </p>
  
  <p>Do either of these things make sense?</p>
  
  <p>Anything else I can try? </p>