Re: FTP and security
| From: | Jason Wong | Date: | Wed, 27 Nov 2002 18:35:12 +0000 |
| Subject: | Re: FTP and security | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-126325@lists.php.net to get a copy of this message | ||
On Wednesday 27 November 2002 03:25, Richard Fox wrote:
> > > To relate this to php, I am ready to give up
> > > trying to make my
> > >
> > > system("scp ......");
> > >
> > > code work, because I will have to give the apache user more permissions
> > > than I am comfortable with.
> >
> > What exactly are the problems you're encountering using scp?
>
> I created an apache user, which I called apache, and made sure this user
> could connect to the remote servers and created rsa keys so no passwords
> would be necessary (so my system($cmd) call would work). This is what
> happens when I run scp:
[snip]
> There is more output, but as you can see the read of the src files failed
> and an empty ibuf is sent. This command line call works if I am a normal
> user for whom I have set up known_hosts and authorized_keys. But the above
> is the result when I run scp as user 'apache'.
Here's what I've used before and it works for me:
In the HOME directory of the apache user I have the usual .ssh/known_hosts
file.
Then in php, simply:
shell_exec("/usr/bin/scp -i id_dsa_key file_to_send user@remote.com:/tmp/");
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Finding out what goes on in the C.I.A. is like performing acupuncture
on a rock.
-- New York Times, Jan. 20, 1981
*/