"Shell In A Box" | shellinabox | A Web-Based SSH Terminal Remote Linux ...

Shell In A Box implements a web server that can export arbitrary command
line tools to a web based terminal emulator. This emulator is
accessible to any JavaScript and CSS enabled web browser and does not
require any additional browser plugins.

apt-cache search shellinabox

  432  apt-get install -f openssl shellinabox
 

  447  vim /etc/default/shellinabox

  455  systemctl enable shellinaboxd.service
  456  systemctl enable shellinabox


  487  systemctl enable shellinabox
  488  systemctl restart shellinabox



this is configration file  open you can change port no and specify ip for login on that machin

 vim /etc/default/shellinabox
===========================================
SHELLINABOX_DAEMON_START=1
SHELLINABOX_PORT=4200                          Seting for Ubuntu
SHELLINABOX_ARGS="--no-beep"                    

======================================

 457  sudo netstat -nap | grep shellinabo
  458  netstat -nap | grep shellinabox






For building shellinabox from source on Debian or RHEL based systems use commands listed below. This will create executable file shellinaboxd in project directory.

    Install dependencies

    apt-get install git libssl-dev libpam0g-dev zlib1g-dev dh-autoreconf

    or

    yum install git openssl-devel pam-devel zlib-devel autoconf automake libtool

    Clone source files and move to project directory

    git clone https://github.com/shellinabox/shellinabox.git && cd shellinabox

    Run autotools in project directory

    autoreconf -i

    Run configure and make in project directory

    ./configure && make

Debian package

For building and installing .deb packages you can use commands listed bellow. Note that dependencies from the first step above are also required.

    Build package

    dpkg-buildpackage -b

    Install package
===========================================================


--------------------------



Shell In A Box – A Web-Based SSH Terminal to Access Remote Linux Servers


Shell In A Box (pronounced as shellinabox) is a web based terminal emulator created by Markus Gutschke. It has built-in web server that runs as a web-based SSH client on a specified port and prompt you a web terminal emulator to access and control your Linux Server SSH Shell remotely using any AJAX/JavaScript and CSS enabled browsers without the need of any additional browser plugins such as FireSSH.

In this tutorial, I describe how to install Shellinabox and access remote SSH terminal using a modern web browser on any machine. Web-based SSH is very useful when you are protected with firewall and only HTTP(s) traffic can get through.
Installing Shellinabox on Linux

By default, Shellinabox tool is included on many Linux distributions through default repositories, including Debian, Ubuntu and Linux Mint.

Make sure that your repository enabled and available to install Shellinabox from the that repository. To check, do a search for Shellinabox with the “apt-cache” command and then install it using “apt-get” command. `
On Debian, Ubuntu and Linux Mint

$ sudo apt-cache search shellinabox
$ sudo apt-get install openssl shellinabox

On RHEL, CentOS and Fedora

On Red Hat based distributions, you need to first have enable EPEL repository and then install it using the following “yum” command. (Fedora users don’t need to enable EPEL, it’s already a part of Fedora project).

# yum install openssl shellinabox

Configuring Shellinabox

By default, shellinaboxd listens on TCP port 4200 on localhost. For security reason, I change this default port to a random (i.e. 6175) to make it difficult for anyone to reach your SSH box. Also, during installation a new self-signed SSL certificate automatically created under “/var/lib/shellinabox” to use HTTPS protocol.
On Debian, Ubuntu and Linux Mint

$ sudo vi /etc/default/shellinabox

# TCP port that shellinboxd's webserver listens on
SHELLINABOX_PORT=6175
# specify the IP address of a destination SSH server
SHELLINABOX_ARGS="--o-beep -s /:SSH:172.16.25.125"
# if you want to restrict access to shellinaboxd from localhost only
SHELLINABOX_ARGS="--o-beep -s /:SSH:172.16.25.125 --localhost-only"

On RHEL, CentOS and Fedora

# vi /etc/sysconfig/shellinaboxd

# TCP port that shellinboxd's webserver listens on
PORT=6175
# specify the IP address of a destination SSH server
OPTS="-s /:SSH:172.16.25.125"
# if you want to restrict access to shellinaboxd from localhost only
OPTS="-s /:SSH:172.16.25.125 --localhost-only"

Starting Shellinabox

Once you’ve done with the configuration, you can start the service by issuing following command.
On Debian, Ubuntu and Linux Mint

$ sudo service shellinaboxd start

On RHEL and CentOS

# service shellinaboxd start

On Fedora

# systemctl enable shellinaboxd.service
# systemctl start shellinaboxd.service

Verify Shellinabox

Now let’s verify whether Shellinabox is running on port 6175 using “netstat” command.

$ sudo netstat -nap | grep shellinabox
or
# netstat -nap | grep shellinabox

tcp        0      0 0.0.0.0:6175            0.0.0.0:*               LISTEN      12274/shellinaboxd

Now open up your web browser, and navigate to https://Your-IP-Adress:6175. You should be able to see a web-based SSH terminal. Login using your username and password and you should be presented with your shell prompt.




===================================================================================


=================================



Shell In A Box is a program create by Markus Gutschke that implements an in-browser command line shell. It works on any JavaScript and CSS enabled web browser.

Installing it on your Linux board you can get the access to the command prompt directly from web without any needs to install terminal software on your PC.
Installing Shell In A Box

From the Acme board command line install the shellinabox debian package by typing:

~# apt-get update
~# apt-get install shellinabox

When finished edit the file /etc/default/shellinabox by changing this line:

SHELLINABOX_ARGS="-s/:LOGIN -t --no-beep"

then restart the Shell In A Box daemon typing:

~# /etc/init.d/shellinabox restart

Create an user for the first login:

~# adduser acme
...

Open your browser on http://board_ip_address:4200 and see the prompt Login via web.

Use the acme user to login and then if you need root privileges change to root by typing:

~# su
...

Troubleshooting
Could happen that the terminal text remain in a single line. In this case use this CSS file

Save this CSS file in /etc/shellinabox/:

    shellinabox.css

Change this line in /etc/default/shellinabox:

SHELLINABOX_ARGS="-s/:LOGIN -t  --no-beep --static-file=styles.css:/etc/shellinabox/shellinabox.css"

Then restart shellinabox:

~# /etc/init.d/shellinabox restart
=========================================



# Shell in a box daemon configuration
# For details see shellinaboxd man page

# Basic options
USER=shellinabox
GROUP=shellinabox
CERTDIR=/var/lib/shellinabox
PORT=4200
OPTS="--disable-ssl-menu -s /:LOGIN"

# Additional examples with custom options:

# Fancy configuration with right-click menu choice for black-on-white:
# OPTS="--user-css Normal:+black-on-white.css,Reverse:-white-on-black.css --disable-ssl-menu -s /:LOGIN"

# Simple configuration for running it as an SSH console with SSL disabled:
# OPTS="-t -s /:SSH:host.example.com"


==================================================






About shellinabox

Greetings Unixmen readers!

We, usually, access any remote servers using well known communication tools like OpenSSH, and Putty etc. But, one important thing is we can’t access the remote systems using those tools behind a Firewall or the firewalls that allow only HTTPS traffic. No worries! We, still, have some options to access your remote systems even if you’re behind a firewall. And also, you don’t need to install any communications tools like OpenSSH or Putty. All you need is only a modern JavaScript and CSS enabled browser. And you don’t need to install any plugins or third party softwares either.

Meet Shell In A Box, pronounced as shellinabox, a free, open source, web based AJAX Terminal emulator developed by Markus Gutschke. It uses AJAX technology to provide the look and feel of a native shell via a web browser. The shellinaboxd daemon implements a webserver that listens on the specified port. The web server publishes one or more services that will be displayed in a VT100 emulator implemented as an AJAX web application. By default, the port is 4200. You can change the default port to any random port number of your choice. After installing shellinabox on all your remote servers that you want to access them from your local system, open up the web browser and navigate to: http://IP-Address:4200/. Enter your user name and password and start using your remote system’s shell. Seems interesting, isn’t it? Indeed!

Disclaimer:

Shellinabox is not a ssh client or any sort of security software. It is just a application that emulates a remote system’s shell via a web browser. Also, It has nothing to do with SSH in anyway. It’s not a bullet proof security way to remote your systems. It is just one of the easiest methods so far. You should not run it on any public network for any reason.
Install shellinabox
In Debian/Ubuntu based systems:

shellinabox is available in the default repositories. So, you can install it using command:

$ sudo apt-get install shellinabox

In RHEL/CentOS systems:

First, install EPEL repository using command:

# yum install epel-release

Then, install shellinabox using command:

# yum install shellinabox

Done!
Configure shellinabox

As I mentioned before, shellinabox listens on port 4200 by default. You can change this port to any random number of your choice to make it difficult to guess by anyone.

The shellinabox config file is located in /etc/default/shellinabox file by default in Debian/Ubuntu systems. In RHEL/CentOS/Fedora, the default location of config file is /etc/sysconfig/shellinaboxd.

If you want to change the default port,

In Debian/Ubuntu:

$ sudo vi /etc/default/shellinabox

In RHEL/CentOS/Fedora:

# vi /etc/sysconfig/shellinaboxd

Change your port to any random number. Since I am testing it on my local network, I use the default values.

# Shell in a box daemon configuration
# For details see shellinaboxd man page

# Basic options
USER=shellinabox
GROUP=shellinabox
CERTDIR=/var/lib/shellinabox
PORT=4200
OPTS="--disable-ssl-menu -s /:LOGIN"

# Additional examples with custom options:

# Fancy configuration with right-click menu choice for black-on-white:
# OPTS="--user-css Normal:+black-on-white.css,Reverse:-white-on-black.css --disable-ssl-menu -s /:LOGIN"

# Simple configuration for running it as an SSH console with SSL disabled:
# OPTS="-t -s /:SSH:host.example.com"

Restart shelinabox service.

In Debian/Ubuntu:

$ sudo systemctl restart shellinabox

Or

$ sudo service shellinabox restart

In RHEL/CentOS systems run the following command to start shellinaboxd service automatically on every reboot.

# systemctl enable shellinaboxd

Or

# chkconfig shellinaboxd on

Remember to open up port 4200 or any port that you assign if you are running a firewall.

For example, in RHEL/CentOS systems, you can allow the port as shown below.

# firewall-cmd --permanent --add-port=4200/tcp

# firewall-cmd --reload

Usage

Now, go to your client systems, open up the web browser and navigate to: https://ip-address-of-remote-servers:4200.

Note: Mention the correct port if you have changed it.

You’ll get a warning message of certificate issue. Accept the certificate and go on.

Privacy error - Google Chrome_001

Enter your remote system’s username and password. Now, you’ll be able to access the remote system’s shell right from the browser itself.

sk@server1:~ - Shell In A Box - Google Chrome_003

You can get some additional menu options which might be useful by right clicking on the empty space of your browser.

sk@server1:~ - Shell In A Box - Google Chrome_004

From now on, you can do whatever you want to do in your remote server from the local system’s web browser.

Once you done, type exit in the shell.

To connect again to the remote system, click the Connect button and then type the user name and password of your remote server.

sk@server1:~ - Shell In A Box - Google Chrome_005

For more details about shellinabox, type the following command in your Terminal:

# man shellinabox

Or

# shellinaboxd -help

Also, refer the shellinabox wiki page for comprehensive usage details.
Conclusion

Like I mentioned before, web-based SSH tools are very useful if you’re running servers behind a Firewall. There are many web-based ssh tools, but Shellinabox is pretty simple and useful tool to emulate a remote system’s shell from anywhere in your network. Since, it is browser based, you can access your remote server from any device as long as you have a JavaScript and CSS enabled browser.

That’s all for now. Have a good day!

Reference link:
===========================================================================

Comments