WEB-based remote Terminal Simulator installation and usage

Source: Internet
Author: User
Tags cgi web ssl certificate root access

Http://lzw.me/a/shellinabox.html A, Shellinabox introduction

Shellinabox is a web-based terminal emulator, written in C, using Ajax to communicate with backend services. It implements a Webserver, which listens to the 4200 port by default and accesses http://host:4200 on browsers that support Javascript and CSS. And you can configure SSL/TLS certificates to encrypt traffic using HTTPS.

Second, Shellinabox installation 2.1 compile and install

wget http://shellinabox.googlecode.com/files/shellinabox-2.14.tar.gz
Tar zxvf shellinabox-2.14.tar.gz
CD shellinabox-2.14
./configure
Make && make install

2.2 Installation Package Installation

In Ubuntu you can also install by downloading the Deb package. As follows:

Http://packages.ubuntu.com/raring/web/shellinabox

Iii. shellinabox start and configuration using 3.1 to generate a PEM certificate

Generate a PEM certificate that can be started in HTTPS mode. The format of the PEM certificate is the public key plus the private key, and is packaged in x509 format.

OpenSSL req-new-x509-nodes-out server.crt-keyout Server.key
Cat Server.crt Server.key >/tmp/certificate.pem

SSL certificates are not required to be generated manually. If you do not generate an SSL certificate, or you do not specify it at startup or cannot find it, and you do not use the-t parameter to disable SSL, the daemon attempts to generate an SSL certificate automatically.

3.2 Start

After installation, you can start with the following command

Shellinaboxd-b-c/tmp

To see if it starts:

NETSTAT-NTPL |grep 4200
Ps-ef |grep Shellinabox

The service defaults to port 4200, which can be accessed as follows: https://yourhostip:4200.

3.3 Related start-up parameters

-B | –background[=pidfile]

Specifies that it runs in the background. If a file path parameter is specified, the Shellinabox process PID is written to it so that the kill can end its run.

-C | –cert=certdir

Specify the certificate directory

–cgi[=portrange]

Run as a CGI Web server extension
This option is mutually exclusive with –background,–pidfile and –port.
To make Shellinabox a valid CGI script, you may have to give shellinabox root privileges, which is not secure.

–css=filename

Specifies the CSS style that defines the color of the interface. The default style is Style.css

-D | –debug

Debug mode, all information will be output on the STDERR standard output.
This parameter is mutually exclusive with –quiet and –verbose.

-F | –static-file=url:file

Replace some special files with user-defined files.
such as Beep.wav, Favicon.ico, Shellinabox.js, Styles.css, Print-styles.css.
You can also specify a directory that contains these files.

-G | –group=gid

Specify the run user group, default to Nogroup

–linkify=[none|normal|aggressive]

Specifies the clickable nature of the connection address that is automatically recognized. such as URLs, FTP, email and so on.

–localhost-only

Only the local loopback interface is monitored for use with reverse proxy. By default, the daemon listens on all available network interfaces.

-N | –numeric

Used in –verbose mode, the logging output uses an IP address instead of the DNS routing table for the domain name.
That is, the client IP address replaces the output of the domain name.

-P | –port=port

Specify the listening port, default 4200

–pidfile=pidfile

The process PID is stored in the specified file

-Q | –quiet

Quiet mode, disable all output to stderr information.
When this parameter is not selected, the standard output stderr displays the information in real time when it is not running in background mode.
This parameter is mutually exclusive with –debug and –verbose.

-S | –service=service

To register more application services so that these services can be accessed through a different URL path.
The format of the service is:
SERVICE: = <url-path> ': ' Application

-T | –disable-ssl

Do not run with SSL

-u | –user=uid

Specify run user, default nobody

–user-css=styles

Customize the user-selectable style appearance, the user can choose by the right-click menu, the selected identity is recorded in the cookie.

Format of Style:
STYLES: = GROUP {'; ' GROUP}*
Format of GROUP:
GROUP: = option {', ' option}*
The format of OPTION:
OPTION: = <label> ': ' ['-' | ' + '] <css-file>

-V | –verbose

Enable logging of Apache-style log files to stderr.
This option is mutually exclusive with the –debug and –quiet parameters.

–version

Print the version number and exit

For more detailed parameter meanings please see help instructions, or see here:

Https://code.google.com/p/shellinabox/wiki/shellinaboxd_man

Shellinaboxd-h

*shellinaboxd* [*-b* | *--background*[=_pidfile_]] [*-c* | *--cert*=_certdir_]     [*--cert-fd*=_fd_] [*--css*=_fil Ename_] [-*-cgi*[=_portrange_]] [*-d* |     *--debug*] [*-f* | *--static-file*=_url_:_file_] [*-g* | *--group*=_gid_]      [*-h* | *--help*] [*--linkify*=[*non E*|*normal*|*aggressive*] [      *--localhost-only*] [*--no-beep*]  [*-n* | *--numeric*] [*--pid-*      *file*=_p Idfile_] [*-p* | *--port*=_port_] [*-s* | *--service*=_service_]      [*-t* | *--disable-ssl*] [*--disable-ssl-menu *] [*-q* | *--quiet*]      [*-u* | *--user*=_uid_] [*--user-css*=_styles_]  [*-v* |  *--verbose*]      [*--version*]

3.4 Some examples of boot configurations

Shellinaboxd-t-F Beep.wav:/dev/null

Do not disable ringing in SSL mode

Shellinaboxd-t-b-q–css=shellinabox/white-on-black.css

Do not use SSL to run quietly in the background, enable color configuration for the black and white interface:

Shellinaboxd-b-c/tmp-p 8080

Let the shellinabox background run, using the certificate under/tmp, the boot port is 8080.

Shellinaboxd-d-s/terminal1/:user:group:homedirectory:/bin/bash #-S Url,user,group,working-dir,command

Bind a Bash

Shellinaboxd-t-S/:login-s/who:nobody:nogroup:/:w

By accessing https://host:4200/who, you can view the current list of logged in users.
Requires root access for account execution.

3.5 Configuration

The Shellinabox is primarily configured with boot parameters and there are no configuration files. The user can right-click on the browser page and choose several settings that will be saved in the cookie.

3.5.1 Configuring reverse proxy access

In addition, you can access it by configuring the reverse proxy in other Webserver to integrate it in the Web site.

When you want to use reverse proxy mode, you need to fill in the startup parameter –localhost-only, and if the proxy server does not support SSL, the –disable-ssl parameter also needs to be filled out.

Cases:

Shellinaboxd–localhost-only–disable-ssl-b-t–css=shellinabox/white-on-black.css

Reference configuration for Apache:

<location/shell>proxypass Http://localhost:4200/Order Allow,denyallow from all</location>

Nginx's Reference configuration:

Location  /  {          proxy_pass http://127.0.0.1:4200;}
3.6 Close Shellinabox

To find the process PID of Shellinabox, Kill can

PS x | grep Shellinaboxd | Grep-v grep | awk ' {print '} '

You can also add the-p parameter at startup, save the process PID to the specified file, read it when it is closed, and kill

3.7 Common reasons for startup failure

The reused port is already in use;
Lack of sufficient authority to run the service;
Failed to find SSL/TLS certificate;
The newly generated certificate authentication directory is not writable, etc.

Iv. Use of Shellinabox

When the Web interface is opened via a URL, all actions are similar to the desktop SSH terminal. Example.

V. Problems in existence BUGS

Interrupt interception of keys such as CTRL, ALT, WIN, and ESC may fail on different browsers. For example, on IE may not be allowed to intercept the ALT key, and always interpret it as a menu shortcut key. Pressing Win+ctrl at the same time may be effective.

The internal clipboard can be accessed by right-clicking, but not IE browser.

Some browsers limit the number of connections to concurrent requests, which limits how many Ajax terminals can be opened at the same time. In this case, users are required to modify the number of concurrent connections in the local browser.

Vi. Other relevant tools

Ajaxterm Https://github.com/antonylesuisse/qweb
Anyterm http://anyterm.org/
Commando.io http://commando.io/
Gate One Http://liftoffsoftware.com/Products/GateOne
Tty.js https://github.com/chjj/tty.js/
Keybox http://sshkeybox.com/
Webmin http://www.webmin.cn/

Vii. Related references

https://code.google.com/p/shellinabox/

Http://wiki.ubuntu.org.cn/UbuntuHelp:Shellinabox

Http://en.wikipedia.org/wiki/Web-based_SSH

Web version SSH Terminal: http://houwenhui.gotoip2.com/archives/1850
Let Shellinabox support ipv6:http://mirror.bjtu.edu.cn/ideal/?p=187

WEB-based remote Terminal Simulator installation and usage

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.