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 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 https://github.com/shellinabox/shellinabox.git && 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 OR $ sudo nano /etc/default/shellinabox
Make the configuration changes as shown below…
# Should shellinaboxd start automatically SHELLINABOX_DAEMON_START=1 # TCP port that shellinboxd's webserver listens on SHELLINABOX_PORT=6175 # Parameters that are managed by the system and usually should not need # changing: # SHELLINABOX_DATADIR=/var/lib/shellinabox # SHELLINABOX_USER=shellinabox # SHELLINABOX_GROUP=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. SHELLINABOX_ARGS="--no-beep" # specify the IP address of an SSH server OPTS="-s /:SSH:192.168.0.140" # if you want to restrict access to shellinaboxd from localhost only OPTS="-s /:SSH:192.168.0.140 --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
Now let’s verify whether Shellinabox is running on port 6175 using the netstat command.
$ sudo netstat -nap | grep shellinabox
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 192.168.0.103 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=192.168.0.103/6175 --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.
You can right-click to use several features and actions, including changing the look and feel of your shell.
For more information, visit the official Shellinabox github page.
It’s a very useful article for me who wants to make an IDE for a program language platform on the web.
But How do you describe how to make it using a thin client PC via the web?
Thanks.
I have two SSH services on same IP i.e on port 22 & 12344. Whenever I try to connect
https://localhost:23167
, I get connected to SSH server running on port 22. How do I connect to SSH services on port 12344?Kindly suggest.
@Ujlain,
You need to specify both port numbers in the sshd_config file, and use the port number to access the SSH, like:
Good article, thanks. I found it more direct than some other pages on how to install shellinabox.
What command did you use to generate the output shown in the second to last screenshot titled “monitoring linux from Web Browser”?
@Porky,
I have used the top command, which is a Linux command line tool that prints actively running Linux processes on the system.
I discovered this issue impacts me.
https://github.com/shellinabox/shellinabox/issues/458
Hello,
I think TTYD is better, as it allows you to share the SSH terminal over the web…
@Tdim,
Thanks for sharing, yes it seems the perfect command-line tool for sharing the Linux terminal over the web…
Why are there so many sentences on this page that make no sense at all?
Make sure that your repository enabled and available to install Shellinabox from that repository.
Thank you very much for your guidance. It does work and is very useful. However, the command line
sudo service shellinaboxd start
was wrong in my Debian 9.11. I had to perform with the one
sudo service shellinabox start
and it works.
Hello, I installed shellinabox on a raspberry pi. Everything works with no problem. However I’m not a Linux guy I’m still learning. I was trying to figure out open ssl but I’m having trouble.
Can someone help me to setup open ssl please?
Joseph
Is there a way to modify the encryption and key exchange used by shellinabox? We would like to limit it to ECDHE ciphers.