Raspberry Pi

Access Raspberry Pi Terminal on the Web Using Shell in A Box

Want to access Raspberry Pi terminal on the web without using any SSH tool? Install Shell In A Box. It is a web-based terminal emulator that enable Raspberry Pi users to access the command-line terminal from any browser using the system IP address. It is designed to be simple, standalone, and secure web application that can be useful for the users who want to remotely access the terminal.

If you wish to install Shell In a Box on Raspberry Pi system, follow this article.

Shell in a Box Installation on Your Raspberry Pi

The Shell in a Box can be installed on Raspberry Pi through the following steps:

Step 1: To install Shell in a Box from the Raspberry Pi source repository, do the following command:

$ sudo apt install openssl shellinabox

Shell In A Box installation takes some time, and you must wait until they are finished.

Step 2: By default, Shell In A Box listens on localhost at TCP port 4200. In order to prevent unauthorized access to your SSH machine, you can change the default port to a random one (i.e., 6175) for security purposes. To change the setting, open the Shell In A Box configuration file through the following command:

$ sudo nano /etc/default/shellinabox

Step 3: Then change the configuration as indicated below.

After making the changes, use “CTRL+X” to save the file, then “Y” to quit.

Step 4: You must restart the Shell In A Box service through the below-given command.

$ sudo systemctl restart shellinabox

Step 5: Following the restart, you can use the following command to check the status of the Shell In A Box service.

$ sudo systemctl status shellinabox

Step 6: Now let’s use the netstat command to see if the Shell In A Box is active on port 6175.

$ sudo netstat -nap | grep shellinabox

Text, chat or text message Description automatically generated

Step 7: Now you have to install Firewall (ufw) on Raspberry Pi through the following command to update the rule for port 6175.

$ sudo apt install ufw

Step 8: To enable remote access to your Linux shell, you must open the port 6175 for Shell In A Box using the following command:

$ sudo ufw allow 6175/tcp

Step 9: Go ahead and open the link https://RaspberryPi-IP-Adress:6175on any browser.

Note: Find IP address for Raspberry Pi using hostname -I command.

Step 10: Continue to the selected IP address using the “Advanced” option if a warning appears on your browser.

Then use the Raspberry Pi default credential to access the Raspberry Pi terminal on the web browser.

Now, you are good to use Raspberry Pi terminal on the web and you can execute command on the Raspberry Pi system directly from your browser.

Removal Of Shell In A Box From Raspberry Pi:

Shell In A Box can be removed from the Raspberry Pi system by running the command on the Pi terminal.

$ sudo apt remove shellinabox

Conclusion

Shell In A Box is an effective tool that allows Raspberry Pi users to remotely access the terminal on the web. You can quickly install this tool on the Raspberry Pi using the apt command. Once it’s done, you have to configure the file and then allow the traffic to port 6175 using the Firewall. Afterwards, you may use the Raspberry Pi’s IP address and the default login and password to access the terminal using a web browser.

About the author

Hiba Shafqat

I am a Computer Science student and a committed technical writer by choice. It is a great pleasure to share my knowledge with the world in which I have academic expertise.