<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/ DTD/wml_1.1.xml">

<wml>
<head>
<meta http-equiv="cache-control" content="max-age=180,private" />
</head>
<card title="Shellinabox：基于 Web 的远程 Terminal 模拟器安装使用详解">
<p>
作者:<a href="index.php?action=showuser&amp;userid=1&amp;hash=">admin</a><br />时间:2016-12-29 11:08<br />分类:<a href="index.php?action=list&amp;cid=3&amp;hash=">电脑技术</a><br />内容:
Shellinabox：基于 Web 的远程 Terminal 模拟器安装使用详解

Shellinabox：基于 Web 的远程 Terminal 模拟器安装使用详解
       Shellinabox 简介


Shellinabox 是一个基于 web 的终端模拟器，采用 C 语言编写，使用 Ajax 与后端服务通信。它实现了一个 Webserver，默认监听 4200 端口，在支持 Javascript 和 CSS 的浏览器上访问 http://host:4200 即可。并且可以配置 SSL/TLS 证书，使用 https 方式加密通信。

     Shellinabox 安装
1 编译安装

wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/shellinabox/shellinabox-2.14.tar.gz

tar zxvf shellinabox-2.14.tar.gz
cd shellinabox-2.14
./configure
make &amp;&amp; make install



2 安装包安装
在Debian / Ubuntu系统上：
shellinabox在默认库是可用的。所以，你可以使用命令来安装它：


    $ sudo apt-get install shellinabox


在RHEL / CentOS系统上：
首先，使用命令安装EPEL仓库：


    # yum install epel-release


然后，使用命令安装shellinabox：


    # yum install shellinabox


完成！

配置shellinabox
正如我之前提到的，shellinabox侦听端口默认为4200。你可以将此端口更改为任意数字，以防别人猜到。

在Debian/Ubuntu系统上shellinabox配置文件的默认位置是/etc/default/shellinabox。在RHEL/CentOS/Fedora上，默认位置在/etc/sysconfig/shellinaboxd。

如果要更改默认端口，

在Debian / Ubuntu：


    $ sudo vi /etc/default/shellinabox


在RHEL / CentOS / Fedora：


    # vi /etc/sysconfig/shellinaboxd


更改你的端口到任意数字。因为我在本地网络上测试它，所以我使用默认值。


    # 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=&quot;--disable-ssl-menu -s /:LOGIN&quot;

    # Additional examples with custom options:

    # Fancy configuration with right-click menu choice for black-on-white:

    # OPTS=&quot;--user-css Normal:+black-on-white.css,Reverse:-white-on-black.css --disable-ssl-menu -s /:LOGIN&quot;

    # Simple configuration for running it as an SSH console with SSL disabled:

    # OPTS=&quot;-t -s /:SSH:host.example.com&quot;


重启shelinabox服务。

在Debian/Ubuntu:


    $ sudo systemctl restart shellinabox


或者


    $ sudo service shellinabox restart


在RHEL/CentOS系统，运行下面的命令能在每次重启时自动启动shellinaboxd服务


    # systemctl enable shellinaboxd


或者


    # chkconfig shellinaboxd on


如果你正在运行一个防火墙，记得要打开端口4200或任何你指定的端口。

例如，在RHEL/CentOS系统，你可以如下图所示允许端口。


    # firewall-cmd --permanent --add-port=4200/tcp
    # firewall-cmd --reload


使用
现在，在你的客户端系统，打开Web浏览器并导航到：https://ip-address-of-remote-servers:4200。

注意：如果你改变了端口，请填写修改后的端口。

你会得到一个证书问题的警告信息。接受该证书并继续。

如果想了解shellinabox更多细节，在你的终端键入下面的命令：

# man shellinabox 
或者

# shellinaboxd -help

</p><p>
<a href="index.php?action=login&amp;hash=">立即登陆发表评论</a><br />
</p>
<p><a href="index.php?action=list&amp;hash=">返回日志列表</a><br /><a href="index.php?action=index&amp;hash=">返回主页</a></p>
</card>
</wml>
