Shellinabox Introduction
Typically, we use common communication tools such as OpenSSH and putty when accessing any remote server. However, it is possible that we cannot use these tools behind the firewall to access the remote system, or the firewall only allows HTTPS traffic to pass. Do not worry! Even if you are behind a firewall like this, we still have a way to access your remote system. Furthermore, you do not need to install any communication tool similar to OpenSSH or putty. You just have to have a modern browser that supports JavaScript and CSS, and you don't have to install any plugins or third-party applications.
This Shell in A Box, pronounced shellinabox, is a free and open source web-based Ajax terminal simulator developed by Markus Gutschke . It uses AJAX technology to provide the look and feel of a similar native Shell through a Web browser.
This shellinaboxd daemon implements a Web server that can listen on a specified port. Its Web server can publish one or more services that appear in the VT100 emulator implemented with AJAX WEB applications. By default, the port is 4200. You can change the default port to any port number you choose. After installing Shellinabox on your remote server, if you want to access from the local system, open a Web browser and navigate to:http://IP-Address:4200/. Enter your username and password, and you can start using the shell of your remote system. It's funny, isn't it? Really interesting!
Disclaimer :
Shellinabox is not an SSH client or any security software. It is just an application that can simulate a remote system's shell through a Web browser. At the same time, it has nothing to do with SSH. This is not a reliable way to remotely control your system safely. This is just one of the simplest ways to date. In any case, you should not run it on any public network.
Installing Shellinabox
On the Debian/ubuntu system:
Shellinabox is available in the default library. So you can use the command to install it:
$ sudo apt-get install shellinabox
On the Rhel/centos system:
First, use the command to install the Epel repository:
# yum install epel-release
Then, install Shellinabox using the command:
# yum install shellinabox
Complete!
Configure Shellinabox
As I mentioned earlier, theShellinabox listening port defaults to 4200. You can change this port to any number in case someone guessed it.
The default location for Shellinabox configuration files on Debian/ubuntu systems is /etc/default/shellinabox. On Rhel/centos/fedora, the default location is /etc/sysconfig/shellinaboxd.
If you want to change the default port,
In Debian/ubuntu:
$ sudo vi /etc/default/shellinabox
In Rhel/centos/fedora:
# vi /etc/sysconfig/shellinaboxd
Change your port to any number. Because I tested it on the local network, I used the default value.
# Shell in a box daemon configuration
# For details see shellinaboxd man page
# Basic options
USER=shellinabox
GROUP=shellinabox
CERTDIR=/var/lib/shellinabox
PORT=4200
OPTS="--disable-ssl-menu -s /:LOGIN"
# Additional examples with custom options:
# Fancy configuration with right-click menu choice for black-on-white:
# OPTS="--user-css Normal:+black-on-white.css,Reverse:-white-on-black.css --disable-ssl-menu -s /:LOGIN"
# Simple configuration for running it as an SSH console with SSL disabled:
# OPTS="-t -s /:SSH:host.example.com"
Restart the Shelinabox service.
In Debian/ubuntu:
$ sudo systemctl restart shellinabox
Or
$ sudo service shellinabox restart
In the Rhel/centos system, run the following command to automatically start the Shellinaboxd service on each reboot
# systemctl enable shellinaboxd
Or
# chkconfig shellinaboxd on
If you are running a firewall, remember to open the port 4200 or any port you specify.
For example, in the Rhel/centos system, you can allow ports as shown.
# firewall-cmd --permanent --add-port=4200/tcp
# firewall-cmd --reload
Use
Now, on your client system, open a Web browser and navigate to:https://ip-address-of-remote-servers:4200.
Note : If you change the port, please fill in the modified port.
You will get a warning message for a certificate issue. Accept the certificate and continue.
And note that when you visit the URL, you remember to use the "https" method
Enter the user name and password for the remote system. You will now be able to access the shell of the remote system from the browser itself.
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/9E/64/wKioL1mRWviwUYApAAEX5KvUynw549.png "title=" Qq20170814160652.png "alt=" Wkiol1mrwviwuyapaaex5kvuynw549.png "/>
Right click on your browser's blank location. You can get some extra menu options that are useful.
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/9E/64/wKioL1mRW4XTyVJcAAD083Snltc341.png "title=" Qq20170814161235.png "alt=" Wkiol1mrw4xtyvjcaad083snltc341.png "/>
From now on, you can use your local system's Web browser to operate on your remote server at your own discretion.
When you finish your work, remember to enter and exit
exit.
When you connect to the remote system again, click the Connect button, and then enter the user name and password for the remote server.
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/9E/64/wKioL1mRW-7xxpMAAACrpXgDOOc929.png "title=" Qq20170814161404.png "alt=" Wkiol1mrw-7xxpmaaacrpxgdooc929.png "/>
If you want to know more details about Shellinabox, type the following command in your terminal:
# Man Shellinabox
Or
# Shellinaboxd-help
At the same time, refer to Shellinabox on the wiki page, to understand the comprehensive use of shellinabox details.
Conclusion
As I mentioned earlier, web-based SSH tools are useful if you are running behind a firewall on a server. There are many web-based SSH tools, but Shellinabox is a very simple and useful tool that can emulate a remote system's shell from anywhere on the network. Since it is browser-based, you can access your remote server from any device as long as you have a browser that supports JavaScript and CSS.
Ubuntn16 Deploying Shellinabox--web Shell Tools