[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] Connecting to ssh server from php script



On Fri, Nov 23, 2007 at 06:33:32PM +0100, Tobias Nissen wrote:
> Expect[0] does exactly that.

expect is not what am I looking for.
I was not very clear in my original post, sorry.

I have web page on server with php running with safe_mode on.
It has fsockopen() enabled.
With this I can connect to telnet server (or smtp, pop3 ...)
and do what I need to do (write command, read response).
Now I want to connect to ssh server from php script that
is on webserver with safe_mode (no system() call).
I was hoping to do it with something like
$fp = fsockoen("ssl://ssh.example.com", 22, $errno, $errstr, 30);
but it does not open the socket.

My friend bring to my attention that there is module available for
php that has binding to libssh2 library. Module has function
ssh2_exec()
ssh2_shell()
Unfortunately web server I have my pages on does not have this module
enabled and they do not plan to change that. (Also I was not able
to find libssh2 library and its php binding in my etch's DVDs).

Now I have two questions:
a) Is it possible to connect and comunicate with ssh server
   with fsockopen()?
b) Does anybody know of some free web hosting service that
   has ssh2_exec() function available?

Thanks
Misko



Reply to: