davidmoreno edited this page May 18, 2011 · 9 revisions

Onion Terminal

oterm is a web browser unix terminal. It serves a console so you can access your server from anywhere in the world where you have an Internet connection. It effectively is an xterm in a browser.

See Oterm screenshot full size

Main features:

  • Standalone Just the executable contains everything you need to serve the terminal.
  • Secure It uses SSL to ensure you use a secure channel.
  • Authenticated It uses PAM to check user authentication, so its easily extensible to use passwd, LDAP, htpasswd files...
  • Session management It exports as many sessions as wanted, per user. So its also a screen replacement.
  • AGPL license.

As an example of what is possible, vi, vim, emacs, zile, htop, top... all work perfectly.

As its over HTTP, there is no connection session, so user can disconnect and come back whenever they feel is necessary, with no need to close the sessions.

Missing features:

  • Some escape codes There are still some escape codes that are not implemented.
  • Better line handling. Currently there is no automatic new line when line overflow, which results on something weird.
  • On reconnect, there is no buffer of current state of the terminal, so a terminal redraw has to be requested. Normally that's just a Control-L.
  • some more session management: close terminals, some signal when terminal process finishes.

Implementation details

This example uses opack to embed jquery and custom javascript and HTMLs.

The handler itself creates the pty (forkpty, set permissions...) and stores all that on the user session.

The input of data is made at oterm/PID/in, and it is a POST with the data at the parameter data. The output is in another channel, oterm/PID/out, and it blocks until there is some data available, then it reads as much as possible and sends it. The AJAX client when receives that data processes it, and asks for new data. With this simple in/out trick we can have the same functionality as WebSockets, but asynchronously.

Oterm is just 380 lines of C code, and 2900 of JavaScript.


Its recommended that you download libonion and compile oterm yourself, anyway here are statically linked binaries that should work on a proper Linux environment. They are compiled with Ubuntu 11.04, but should work on any other environment.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.