Is it possible to connect to SSH using JavaScript?

Viewed 37923

I know there is an implementation of VNC using WebSockets (http://novnc.com) but that still requires a server. I am looking to create a simple client-side JavaScript only (no Flash) connection to a port running SSH. I am guessing WebSockets is the only way to go since it does TCP. Any example code? Any other way?

5 Answers

Yes you can

  1. Install SSH server on your server

  2. Write a server side program (could be in PHP) that uses SSH client in the background

  3. Redirect messages between the SSH client (that probably has been residing in the same server as SSH server) and the JavaScript program in the web browser other side of the internet.

That server side program acts like a postman only and the java script program in the browser is just another postman between the user and server program.

(SSH server)<->(SSH client)<->(PHP e.g)<->(JavaScript)

Also don't forget that in the JavaScript program could have use Ajax for better mechanism. Also SSH client might be not completely and absolutely necessary because that PHP server side program could directly connect to SSH server

Related