Did You Know?
Got a tip? Let us know

LFCS - Linux Foundation Certified SysAdmin - Exam Preparation Guide

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

Download Your Free eBooks NOW - 10 Free Linux eBooks for Administrators

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.

Install Shellinabox in Linux

Shellinabox SSH Login

Shellinabox SSH Shell

Shellinabox SSH Shell

Shellinabox SSH Logout

Shellinabox SSH Logout

You can right-click to use several features and actions, including changing the look and feel of your shell.

Shellinabox More Options

Shellinabox More Options

Make sure you secure you shellinabox on firewall and open 6175 port for specific IP Address to access your Linux shell remotely.

Reference Links

Shellinabox Homepage

Ravi Saive

Owner at TecMint.com
Simple Word a Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux.

Linux Services & Free WordPress Setup

Our post is simply ‘DIY’ aka ‘Do It Yourself, still you may find difficulties and want us to help you out. We offer wide range of Linux and Web Hosting Solutions at fair minimum rates. Please submit your orders by Clicking Here.

29 Responses

  1. Rajesh Kotla says:

    Excellent article worked like a charm.

  2. Nuno Silva says:

    Hi Ravi, another great post!

    I’m using Ubuntu 12.04.3 LTS and the apt-get install openssl shellinabox didn’t work (i checked everything with the repositories and everything was ok.

    To install it, i did this:

    # wget http://archive.ubuntu.com/ubuntu/pool/universe/s/shellinabox/shellinabox_2.14-1_i386.deb (for the 32bit version)

    #dpkg -i shellinabox_2.14-1_i386.deb

    Got this tips from: http://www.linuxplained.com/install-shellinabox-on-ubuntu/

    Keep up the good work!

  3. Clemo says:

    Thanks for this article. I wanted to point out that to start it up on RHEL and CentOS you need to add the “d” at the end, thus

    “service shellinaboxd start”

  4. Yogesh says:

    This required live (fix) ip address from your ISP? Or can we achieve the same with out it? Please help.

    -Y

  5. Jegs Meganu says:

    When I type my username then press enter it will automatically closed session then I have to click the connect the button again then again and again and again….

  6. Om says:

    Thanks for the article. I need to run a shell script on a remote machine (BOX A) interactively from the browser (Client). Currently, i am able to run a script on a remote machine (BOX A) using the php and ssh running on appache webserver(BOX B). The php is on a webserver(BOX B) and Shellscirpt on remote machine (BOX A). But I need to key any input/prompt that needs user input, i can;t get to the remote machine. Can you please tell me how to achieve this.

  7. jozef says:

    Didn’t you have a problem starting shellinabox on Debian? When i installed it from reposotory (apt-get install) it had worked fine until I restarted the mashine and then it can not be start automaticly.
    It also can not be start by command service shellinabox start, producing the error message Cannot look up group “shellinabox”.

    Has anybody faced this problem yet?

  8. Omar says:

    Hello.
    Thanks for this good article.
    Maybe you can tell where to look for
    My server is a Centos linux box
    When I do the connection I get:
    181 login:
    I type root
    The prompt for Password never appears.
    Any idea?

  9. Omar says:

    Thanks. I solved.
    I just changed my /etc/sysconfig/shellinaboxd file:
    OPTS=” -s /:SSH”
    and It worked fine

  10. Rohit says:

    Hay it worked! Nice article.
    But it does not work with some browsers which browser on windows 8 maybe…

  11. Romain says:

    Nice post, worked fined for me :-)

    I’m connecting from Ubuntu, it’s working from Firefox but not from chrome (nothing’s display on chrome…)

    So if you have problem with chrome have a try with another brother.

  12. Luciano Grisoste says:

    Perfect! Worked perfectly on Debian 7 My. Fine contribution.

  13. Tito says:

    Thanks for this good article :)

  14. Rizwan Gill says:

    When I try to execute the command
    I met with the following error
    #service shellinaboxd start
    Starting shellinaboxd: Cannot look up user id “-g”
    But if i check the #service shellinaboxd status
    It displays shellinaboxd is stopped
    Any idea how to start it?

    • Bennet says:

      Did you ever figure this out? There doesn’t seem to be any real information on this. I can start it by executing it in the foreground but for some reason the service doesn’t want to work.

    • Bennet says:

      Got it up and running by using the following;

      /etc/init.d/shellinaboxd start
      After adding the following to /etc/sysconfig/shellinaboxd

      USER=
      GROUP=
      CERTDIR=/var/lib/shellinabox

      in addition to the ones specified above.

  15. sfdf says:

    Not working in IE11, FIREFOX 28.0,

    Chrome 33.0.1750.154 m works fine.

  16. Guillermo Yam says:

    hello people

    i am trying configure the keyboard for to use the letter Ñ, because i am in mexico, whats parameters i need to use and which files will be changed?

  17. Hari says:

    Does not seem to work on RedHat 6.1 even though the installation and verification works fine. I can see the port is listening but cannot establish connection from outside the server.

  18. Nguyen Dai Son says:

    Report at step <>

    LSB_RELEASE NOTE
    Ubuntu 14.04 LTS
    ….

    CONFIGUREATION
    SHELLINABOX_ARGS=”–o-beep -s /:SSH:myIpAddr –localhost-only”

    ERROR
    sudo service shellinabox start
    /usr/bin/shellinaboxd: unrecognized option ‘–o-beep’

    CHANGE
    I change the option to ‘–no-beep’ it is OK.
    SHELLINABOX_ARGS=”–no-beep -s /:SSH:myIpAddr –localhost-only”

  19. Arun says:

    hi..

    any idea on how to name the tabs as perthe routers hostname..

  20. Seetha says:

    Is there a way to login a user while starting this interface?

Leave a Reply

This work is licensed under a (cc) BY-NC | TecMint uses cookies. By using our services, you comply to use of our cookies. More info: Privacy Policy.
© 2012-2014 All Rights Reserved.