Shell In A Box – A Web-Based SSH Terminal to Access Linux via Browser

Shell In A Box (pronounced as shellinabox) is a web-based terminal emulator created by Markus Gutschke. It has a built-in web server that runs as a web-based SSH client on a specified port and prompts you to 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 for any additional browser plugins such as FireSSH.

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

Installing Shellinabox on Linux Systems

By default, the Shellinabox tool is included on Debian-based Linux distributions through default repositories using the default package manager as shown.

Install Shellinabox on Debian, Ubuntu & Mint

$ sudo apt install openssl shellinabox
Install Shellinabox in Ubuntu
Install Shellinabox in Ubuntu

Install Shellinabox on RHEL, Fedora, Rocky & AlamLinux

On Red Hat-based distributions, you need to install it from the source using the following commands.

# yum install git openssl-devel pam-devel zlib-devel autoconf automake libtool
# git clone && cd shellinabox
# autoreconf -i
# ./configure && make

Configuring Shellinabox in Linux Systems

By default, shellinaboxd listens on TCP port 4200 on localhost. For security reasons, 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 is automatically created under “/var/lib/shellinabox” to use HTTPS protocol.

$ sudo vi /etc/default/shellinabox
$ sudo nano /etc/default/shellinabox

Make the configuration changes as shown below…

# Should shellinaboxd start automatically

# TCP port that shellinboxd's webserver listens on

# Parameters that are managed by the system and usually should not need
# changing:
# SHELLINABOX_DATADIR=/var/lib/shellinabox
# SHELLINABOX_USER=shellinabox

# Any optional arguments (e.g. extra service definitions).  Make sure
# that that argument is quoted.
#   Beeps are disabled because of reports of the VLC plugin crashing
#   Firefox on Linux/x86_64.

# specify the IP address of an SSH server
OPTS="-s /:SSH:"

# if you want to restrict access to shellinaboxd from localhost only
OPTS="-s /:SSH: --localhost-only"

Once you’ve done with the configuration, you can restart and verify the shellinabox service by issuing the following commands.

$ sudo systemctl restart shellinabox
$ sudo systemctl status shellinabox
Start Shellinabox in Linux
Start Shellinabox in Linux

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

$ sudo netstat -nap | grep shellinabox
Check Shellinabox Port
Check Shellinabox Port

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

------- On Debian, Ubuntu and Mint -------
$ sudo ufw allow 6175/tcp
$ sudo ufw allow from to any port 6175   

------- On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux -------
$ sudo firewall-cmd --zone=public --add-port=6175/tcp  
$ sudo firewall-cmd --zone=public --add-source= --permanent

Access Linux SSH Terminal via Web Browsers

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. Log in using your username and password and you should be presented with your shell prompt.

Access Linux SSH Terminal in Web Browser
Access Linux SSH Terminal in Web Browser
Monitoring Linux from Web Browser
Monitoring Linux from Web Browser

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

Shellinabox Options and Usage
Shellinabox Options and Usage

For more information, visit the official Shellinabox github page.

Tutorial Feedback...
Was this article helpful? If you don't find this article helpful or found some outdated info, issue or a typo, do post your valuable feedback or suggestions in the comments to help improve this article...

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

81 thoughts on “Shell In A Box – A Web-Based SSH Terminal to Access Linux via Browser”

    • @Prudhvi,

      Because, shellinabox works on TCP port 4200 and 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.

    • Unfortunately it cannot. Only one service can listen to a port (e.g. 443) at a time. It can be either Shellinabox OR Apache, but not both at the same time.

      • You can use it together with apache with a extra config like this in the sites-available:
        I typed it over, so maybe the config is not exact, but this works

          proxypreservehost on
          proxypass  "/" "https://youropenboxserver:4200/"
          proxypassreverse "/" "https://youropenboxserver:4200/"

        restart apache and you have an extra entry for https :)

        • Oh, right, via Apache’s internal proxy config. That didn’t occur to me. The lines above will probably have to go between tags though to limit it to https only (and the certificates will have to be configured as well of course).

    • @Esteban,

      If it’s available for Windows platform, then you can install it, just check their download page and see whether its available for all architectures..

  1. 1- How to SSH shellinabox using Javascript?
    2- Is it required to have a SSL certificate?
    3- Needed it because I want to pass commands from Client side to the server side(Shellinabox web server).Any help?!

  2. Hi,

    How can I configure shellinabox for auto-login?
    For example when I access my server:port for shellinabox – I want it to sign in automatically to the root user and run a predefined script. (I already configured the script correctly – you cannot ctrl +d or ctrl+c from it – and when it ends, it throws you out of the root user session without possibility to get back to it).


  3. Hi Ravi, I have the similar requirement but I can not really install shell in a box at remote machines. We have restrictions we can not ask client to install that. But we need provide web based ssh terminal user will enter credentials to login. Do you know how this can be done?

      • but this needs to be installed on the server. This i can not do because those servers are remote and owned by different people. Can i have something without setting up on server?

        • @Kiran,

          How can you have something without setting up? not possible, you need to have a tool in place to achieve the same..I hope you understand..

          • Thank you Ravi for confirming. I had the same thought but i was still searching for options since i have the requirement in my application. Now i have expert input, will have to find other alternatives.

  4. Hi, I tried to install this on my centos server and there is only one user root.
    I didn’t make change to config file and tried to start it.
    It gives error below, am I missing something?
    Starting shellinaboxd: [server] Cannot look up user id “-g”!

    • @Henry,

      On which version of CentOS you’re trying to install Shellinabox? the error seems new to me and also there isn’t any information about such error on web.

  5. Hi! I just have installed it on my server and will try it out when I am back in the company. Two comments:

    1. In the installation doc above on this web page you say “Starting Shellinabox” with “sudo service shellinaboxd start” but its should be “sudo service shellinabox start” without the “d”.

    2. Can I restrict shellinabox for only one single user account? I’d like to prevent the root accounts from being attacked with brute force attacks through the browser.

    -wbr, Andreas

    • @Andreas,

      Thanks for findings, but different Linux OS provides different deamon names for example, in CentOS you will get shellinaboxd and whereas in Ubuntu you will get without ‘d’ at the end..

      And about user restriction in shellinabox, no idea about it, I think you should read its configuration to know more about it, might be there is a way to do it..

  6. This sounds awful to me! Any idea what port I can use, when sitting behind a firewall that blocks almost all of th ports?

    • @Andreas,

      May I know on which Linux distribution you were trying? have you opened port on the firewall? or have you changed default port to custom in /etc/default/shellinabox file?

      • The targeting distribution is Ubuntu, but the problem is on the site I’m trying to access it from. The company I’m in is blocking almost all outgoing traffic. Not even sure if I could use 443, because I don’t own an official certificate. Maybe 8080 could be an option, not even sure about this. (in fact there is no information about what’s blocked). So best would be if I could use a subnet web page (on port 80) instead of using a different port. I wonder if using a subnet page and mapping it with htaccess to another port on my server, but I have to admit I’m not familiar with this stuff… Any idea?

        • @Anreas,

          Sorry, but I don’t think that would be possible to allow a subnet in shellinabox configuration, let me check and get back to you if I found any solution..


Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.