Best Web-based SSH Client To Linux with Shell in A Box
In this tutorial from Orcacore, we aim to guide you through the process of connecting to your Linux server via a web-based SSH client. We received requests from users seeking a method to control their Linux servers through common web browsers like Firefox, Chrome, and others.
Therefore, this article will demonstrate how to install and configure Shell in A Box, enabling you to access your Linux terminal through a browser without relying on external software.
Introducing Shell in A Box
Shell in A Box is a web-based terminal emulator developed by Markus Gutschke. This emulator incorporates a built-in web server that provides a Linux terminal interface accessible via the web using a designated port.
By installing and configuring this tool on your Linux server, you can connect to your Linux terminal through a browser with Ajax/JavaScript and CSS-enabled capabilities, allowing you to execute commands seamlessly.
As you’ve gathered, this article focuses on installing and configuring Shell in A Box to establish web-based SSH client access to your Linux terminal. Let’s begin.
Install Shell in A Box on Ubuntu and Debian
To install Shell in A Box on Ubuntu and Debian, use the following command:
sudo apt install openssl shellinabox
Install Shell in A Box on CentOS, Almalinux, Rocky Linux
Installing Shell in A Box on CentOS, AlmaLinux, and Rocky Linux requires compiling from source. Use 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
As you can see, installing Shell in A Box on CentOS, AlmaLinux, and Rocky Linux involves downloading the source code from Git and compiling it using several commands.
Configure Shell in A box for Web-based SSH client
After installing Shell in A Box, you can access the web interface using the default port, which is 4200.
However, it’s highly recommended to change the port for security reasons.
For example, let’s change the port to 7429. You can choose any available port you prefer.
To change the port, you need to edit the Shell in A Box configuration file.
Open the configuration file with your preferred editor:
nano /etc/default/shellinabox
Then, on the SHELLINABOX_PORT=
line, edit the port number as shown in the image below.

Save and exit the file, then restart and enable the service using the following commands:
systemctl restart shellinabox
systemctl enable shellinabox
Now, you need to open the Shell in A Box port on your firewall to allow web-based SSH client access from your browser.
Open Web-Based SSH Port on UFW for Debian and Ubuntu
ufw allow 7429/tcp
ufw reload
If you encounter any issues with the UFW firewall, refer to the 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
For additional Firewalld assistance, consult the FirewallD Configuration on AlmaLinux article.
Note: For improved security, it is best to restrict access to the Shell in A Box port to specific IP addresses.
Open Linux SSH Terminal via web browser
Open your web browser, such as Chrome or Firefox.
Enter the domain or IP address of your server with HTTPS like https://your-server-ip-address
.
After bypassing the SSL alert, enter your username and password.
If you followed all the steps correctly, you should see your Linux terminal, as depicted in the image below.

That’s it! You can now access your Linux Terminal from web browsers using the web-based SSH client.
Conclusion
In this article, we demonstrated the installation and configuration of Shell in A Box on Ubuntu, while also providing the commands needed for other Linux distributions.
Following installation and configuration, you can access a web-based SSH client from any browser.
Remember to prioritize security by changing the default port and restricting access to specific IP addresses to mitigate potential security risks when using the web-based SSH client.
I hope this article about web-based SSH client to Linux was helpful. You may also be interested in these articles:
Using SCP to Transfer Files with SSH keys Ubuntu
Execute Shell Commands in Python with Examples
Set and Unset Environment Variables in Linux with Examples
Alternative Solutions for Web-Based SSH Access
While Shell in A Box provides a functional solution, other options exist for achieving web-based SSH access to your Linux server. Here are two alternatives, along with explanations and code examples:
1. Using Apache Guacamole
Apache Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH. Guacamole’s advantage lies in its ability to centralize access to multiple servers through a single web interface, offering enhanced security and management features. It provides a more robust and scalable solution compared to Shell in A Box.
Explanation:
Guacamole works by acting as an intermediary between the user’s web browser and the remote server. It translates user input from the browser into the appropriate protocol (SSH in this case) and forwards it to the server. The server’s response is then translated back into a format suitable for display in the browser. This allows users to access their servers without needing any specialized software on their local machines.
Installation and Configuration (Example for Ubuntu):
# Install Guacamole
sudo apt update
sudo apt install guacamole guacamole-tomcat
# Configure Guacamole (basic steps, requires more in-depth setup)
sudo nano /etc/guacamole/guacamole.properties
# Add database configuration (e.g., using MySQL/MariaDB)
# Configure Tomcat
sudo systemctl restart tomcat9
# Access Guacamole via web browser (default port 8080)
# http://your-server-ip:8080/guacamole
Note: A full Guacamole installation involves configuring a database, setting up authentication, and defining connections to your SSH servers. This is a more complex setup than Shell in A Box, but offers greater functionality and scalability. Refer to the official Apache Guacamole documentation for detailed instructions.
2. Using a Web-Based SSH Terminal with a Reverse Proxy (Nginx or Apache)
Another approach involves using a standalone web-based SSH terminal application (like ttyd) and securing it behind a reverse proxy like Nginx or Apache. This method offers more control over the terminal’s appearance and functionality while leveraging the security features of a well-configured web server.
Explanation:
ttyd is a lightweight, cross-platform alternative that provides a command-line interface in a web browser. It handles the SSH connection directly, while Nginx or Apache acts as a reverse proxy, handling SSL encryption, authentication, and potentially limiting access based on IP address.
Installation and Configuration (Example using ttyd and Nginx):
# Install ttyd (example using npm, other installation methods available)
sudo apt install npm
sudo npm install -g ttyd
# Run ttyd
ttyd -p 7681 bash # This will expose a terminal on port 7681
# Install Nginx
sudo apt install nginx
# Configure Nginx as a reverse proxy
sudo nano /etc/nginx/sites-available/default
# Add the following configuration block inside the server block:
location /ssh/ {
proxy_pass http://localhost:7681/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
# Enable the configuration
sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/
sudo systemctl restart nginx
Code Example (Nginx Configuration):
server {
listen 80;
server_name your-server-ip;
location /ssh/ {
proxy_pass http://localhost:7681/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
Access the terminal via http://your-server-ip/ssh/
. Remember to configure SSL (HTTPS) for security.
This setup offers a balance between simplicity and control. ttyd provides the web-based terminal, while Nginx handles security and routing. The configuration can be customized further to implement authentication and authorization mechanisms within Nginx. The best web-based SSH client depends on your specific needs.