Share your love
Web-based SSH Client To Linux
In this tutorial from Orcacore, we want to teach you how to connect Linux with web-based SSH.
Some of our users requested that we prepare a tutorial for them so that they can control their Linux server through browsers such as Firefox, Chrome, or any other browser.
Accordingly, in this article, we decided to teach you how to install and configure Shell in A Box so that you can connect to your Linux terminal through a browser without the need to use external software.
Introducing Shell in A Box
Shell in A Box is a web-based terminal emulator developed by Markus Gutschke. This emulator has a built-in web server that provides the Linux terminal through the web with a specified port.
By installing and setting up this tool on your Linux server, you can connect to your Linux terminal through a browser with Ajax/JavaScript and CSS-enabled and execute your commands completely.
So far, you have noticed that in this article we are going to install Shell in A Box and configure it to access the Linux terminal via Web based SSH client.
Let’s get started.
Access to Linux with Web-based SSH client
Install Shell in A Box on Ubuntu and Debian
You can use the following command to install this tool in Ubuntu and Debian
sudo apt install openssl shellinabox
Install Shell in A Box on CentOS, Almalinux, Rocky Linux
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
As you see, Shell in A box on CentOS, AlmaLinux, and Rocky Linux need to download source code from git and make with several commands.
Configure Shell in A box for Web-based SSH client
After installing Shell in A Box, you can access the web view by Shell in a Box default port which is 4200.
But we recommended that you change the port for security reasons.
For Example, we will change the port to 7429, you can choose your desired port.
To change the port, you need to edit the Shell in A Box configuration file.
Open the configuration file with your desired editor.
nano /etc/default/shellinabox
Then, on the SHELLINABOX_PORT= line, edit the port. Like the below image.
Save and exit the file and restart and enable service with the below command.
systemctl restart shellinabox
systemctl enable shellinabox
Now, you need to open Shell in A box port on your firewall to access Web based SSH client from browser.
Open Web-Based SSH Port on UFW for Debian and Ubuntu
ufw allow 7429/tcp
ufw reload
If you have any problem with the UFW firewall you can follow Configure Firewall with the UFW article.
Open Web Based SSH Port on Firewalld for AlmaLinux, Rocky Linux, and CentOS
firewall-cmd --zone=public --add-port=6175/tcp
firewall-cmd --reload
Also, if you need more help with Firewalld, you can see FirewallD Configuration on AlmaLinux
Note: For more security, it is better to limit access to the Shell in A Box port only for a specific IP address(s).
Open Linux SSH Terminal via web browser
Open your web browser like Chrome or Firefox
Enter the Domain or IP address of your server with HTTPS like https://your-server-ip-address.
Then after the pass SSL alert, enter your username and password.
If you follow all the steps correctly, you will see your Linux terminal like the below image.
That’s it.
Now, you can access to Linux Terminal from web browsers.
Conclusion
In this article, we try to install and configure Shell in A Box tools to Ubuntu, but we wrote all the commands you need to install this tool to other Linux distributions.
After installation and configuration, you can access Web-based SSH clients from all browsers.
In the end, keep in mind to observe all the security tips change the main port, and make sure to give access to a specific IP address so as not to have security problems.
I hope the Web-based SSH client to Linux article was useful for you.