xterm-js-ssh2-websocket-stream-browserify-webssh.md (1297B)
1 # xterm.js + ssh2 + websocket-stream + browserify = webssh 2 3 While pondering ideas for a website facelift, there was an idea to have a terminal for easy ssh access. However, none of the readily available options really suited my fancy; [wssh](https://github.com/aluzzardi/wssh) came close, but it was actually doing ssh on the server side, and throwing the raw data inside websockets. 4 5 Fortunately [npm](https://npmjs.com/) is full of nice bits and pieces to build on, and [browserify](http://browserify.org/) makes it quite easy to use most of them in a browser too. 6 7 Long story short, in the end it only required about a [screenful of glue code](https://inz.fi/p/webssh.javascript) to tie in the bits, and voilĂ . Place the code in webssh.js, grab also the [test html file](https://inz.fi/p/webssh.html5). 8 9 $ npm install xterm ssh2 websocket-stream browserify 10 $ `npm bin`/browserify webssh.js > bundle.js 11 $ websockify 8022 localhost:22 12 13 (You'll need npm and [websockify](https://pypi.python.org/pypi/websockify) for the above). Then launch the html file in your favorite browser, and login. Tune the addresses to your liking. 14 15 There's also a [demo version](http://inz.fi/webssh/), just enter your websocket endpoint (for example ws://localhost:8022), username and password, and on you go. 16