This article is reproduced from:
Shellinabox: A WEB-based terminal emulator using AJAX
I. Introduction of Shellinabox
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.
Second, installation 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!
Third, configuration Shellinabox
As I mentioned earlier, the Shellinabox 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.
1. 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"
2. Restart the Shelinabox service
In Debian/ubuntu/cenotos:
- $ 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
Iv. Use of
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.
Privacy Error-google chrome_001
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.
Shell in A box-google chrome_003
Right click on your browser's blank location. You can get some extra menu options that are useful.
Shell in A box-google chrome_004
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 andexitexit.
When you connect to the remote system again, click the Connect button, and then enter the user name and password for the remote server.
Shell in A box-google chrome_005
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.
That's all. Wish you have a good mood today!
Reference Links:
Via:shellinabox–a Web based AJAX Terminal Emulator
SK Translator: xiaoyu33 proofreading: Wxy
This article by LCTT original translation, Linux China honors launch
This article permanently updates the link address : http://www.linuxidc.com/Linux/2015-08/121865.htm
Report:
GitHub source
Shellinabox Installation and Use tutorial