Shell in a Box – Remote Linux Server via Web Browser

23 Jun, 2021
For accessing Linux-based machines, Secure Shell (SSH) is used and for accessing Windows-based machines, Remote Desktop Protocol (RDP) is used. Putty is the most famous SSH client in windows. Just like that, SSH can be used for accessing the Linux server remotely via a web browser using shellinabox application.
Shellinabox is a free, open-source, web-based terminal emulator that uses Ajax technology to provide the appearance of a native shell. It was developed by Markus Gutschke. It has the following features:
Shellinabox has a built-in web server that lets you run a web-based SSH client on a specified port.A web terminal emulator will be provided for remotely accessing the Linux Server SSH Shell from any web browser that supports AJAX/JavaScript and CSS without using any extra browser plugins like FireSSH.If SSL/TLS certificates are installed, then all client-server communications are encrypted. When shellinabox is installed, at that time a new self-signed SSL certificate will be installed, the details can be found in /var/lib/shellinabox (to use HTTPS). One can install own SSL certificate.
Shellinabox has a built-in web server that lets you run a web-based SSH client on a specified port.
A web terminal emulator will be provided for remotely accessing the Linux Server SSH Shell from any web browser that supports AJAX/JavaScript and CSS without using any extra browser plugins like FireSSH.
If SSL/TLS certificates are installed, then all client-server communications are encrypted. When shellinabox is installed, at that time a new self-signed SSL certificate will be installed, the details can be found in /var/lib/shellinabox (to use HTTPS). One can install own SSL certificate.
For installing shellinabox on a Debian/Ubuntu-based system, follow the given command:
$ sudo apt-get install shellinabox
After successful installation, let’s see the next steps to follow for using shellinabox:
Step 1- Start the shellinabox daemon using the following command:
$ sudo /etc/init.d/shellinabox start
Step 2- By default, shellinaboxd listens on TCP port 4200, but it is possible to change it. For changing the port number, edit the port number using the following command:
$ sudo vi /etc/default/shellinabox
Step 3- Restart the shellinabox daemon using the following command:
$ sudo /etc/init.d/shellinabox restart
Step 4- Now verify whether Shellinabox is running on the port that was changed or not using the following command:
sudo netstat -nap | grep shellinabox
Step 5- Next step is to open a web browser, and navigate to “https://server_ip_address:port_number”. A web-based SSH terminal can be seen on the screen that will tell to log in using your username and password like this:
Step 6- Right-click in the browser to get different features, and if you are inactive for some time, the sessions get disconnected. Connect again by clicking on connect the button.
Note: DO NOT forget to secure the shellinabox with a firewall and open the assigned port(default one or the manual port you gave) for only specific IP Addresses to access your Linux shell remotely. This will protect from attackers.
Picked
Linux-Unix
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.