Web Hosting Talk







View Full Version : Running commands over SSH


mind21_98
08-27-2002, 05:46 PM
I was thinking of creating a site that will automatically install commonly used CGI scripts for you (i.e. upload all files where they should go, add the proper path to Perl and all that good stuff). In order to do some of the application scanning, I would need to have my PHP script SSH into the client's account.

I think I could do it via RSA keys, but some hosting clients don't know enough of SSH to set them up. Would there be some way to feed in the password directly to ssh in PHP?

benoire
08-28-2002, 12:25 PM
Not every hosting account has SSH access, and this would also limit your script to Linux servers... how about giving your clients a script to upload to their site which doesn't need any permissions set etc, and which can then talk to your website and pass it the information that way if you follow me (just yell at me if you don't ;))

mind21_98
08-28-2002, 03:02 PM
Originally posted by benoire
Not every hosting account has SSH access, and this would also limit your script to Linux servers... how about giving your clients a script to upload to their site which doesn't need any permissions set etc, and which can then talk to your website and pass it the information that way if you follow me (just yell at me if you don't ;))

It'd kinda ruin the whole purpose of such a script (which takes care of everything for you). However, I could FTP it up there automatically for them. Hmm.

benoire
08-28-2002, 05:23 PM
That did cross my mind, which is why I said it should only be a simple thing that requires no configuration etc. Like you say, though, you could FTP it across from your site and do it that way. I don't think accessing via SSH is a good avenue to go down though for the reasons I gave before.

Ahmad
08-28-2002, 05:23 PM
Yeah. I would say FTP. There is no need for SSH. It will work for both, linux and windows servers.

mind21_98
08-28-2002, 05:29 PM
Originally posted by Ahmad
Yeah. I would say FTP. There is no need for SSH. It will work for both, linux and windows servers.

The script'll need different code for both platforms too (in terms of path to Perl, etc.). Windows will be a bigger pain than it's worth, so I'll just initially support Linux for now.

benoire
08-28-2002, 05:36 PM
Originally posted by mind21_98


The script'll need different code for both platforms too (in terms of path to Perl, etc.). Windows will be a bigger pain than it's worth, so I'll just initially support Linux for now.
Why would you need different code? Just have a simple script which you FTP across that grabs all the server/env variables and opens a socket to your site to pass them across or something and you should have all the info you need, no?

mind21_98
08-28-2002, 05:38 PM
Originally posted by benoire

Why would you need different code? Just have a simple script which you FTP across that grabs all the server/env variables and opens a socket to your site to pass them across or something and you should have all the info you need, no?

Windows boxes don't have 'locate' or 'whereis' for instance, so you can't just run "whereis perl". :) They might run Perl a bit differently though.

Ahmad
08-28-2002, 10:36 PM
Well, you can have your script try to determine any information, and then ask the user anything you can't find.