httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henry" <he...@ix.netcom.com>
Subject Re: [users@httpd] calling ssh/scp shell processes from within apache
Date Wed, 17 Mar 2004 00:35:53 GMT

I'm doing the exact same thing... and here's what a friend of mine told me to do, and it works.
 

---------
Both scp and sftp use the same authentication mechanisms as ssh. They'll 
prompt for a password if they can't authenticate some other way; you 
could probably watch for the prompt in PHP, but I'd recommend running 
"ssh-keygen -t dsa" as the web server user, in that user's $HOME, to 
create a keypair with no passphrase. Then copy the public key into the 
destination machine's $HOME/.ssh/authorized_keys file with mode 600, and test 
that you can ssh as the web server user to the destination machine 
without typing anything.

Once that works, you should be able to call scp from system() to copy 
your files over.
---------

-Hank


----- Original Message ----- 
From: <jeffrey_n_Dyke@Keane.com>
To: <users@httpd.apache.org>
Sent: Tuesday, March 16, 2004 4:13 PM
Subject: [users@httpd] calling ssh/scp shell processes from within apache


> 
> I realize this is not solely an Apache question, i'm also posting to a php
> list, and didn't want to cross post.
> 
> I have a page, written in PHP that calls three shell commands.  I'm calling
> scp, then ssh and scp again.  I am using full paths when calling these
> programs, i.e. /usr/bin/scp, /usr/bin/ssh.  The script works fine if
> executed from the command line, as the user Apache runs as.  When i try to
> execute similar code from a web browser being served up by Apache, none of
> the commands seem to execute.
> 
> I would assume this has something to do with the environment the web
> process runs in??  The ssh/scp connection autheticates with public key pair
> authentication, which may not be allowed in this context.  I think/pretty
> sure its getting challenged for the passphrase.
> but, i'll send this anyway...just in case anyone has any insight/expierence
> with this.
> 
> Server in question is Solaris9 with Apache 1.3.9/PHP 4.3.3
> 
> TIA.....Sorry for the slightly off topic post.
> Jeff
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message