Shellinabox 简明教程
Shellinabox
是个基于浏览器的中断模拟器,内置的Web服务器,代理 SSH 的登陆端口内容, 通过 websocket
的内容将内容在浏览器中实现命令行交互.
安装 Shellinabox
在大多数发行版中, Shellinabox
已经集成到系统默认仓库中,使用对应的包管理器即可安装.
RHEL/CentOS
yum install openssl shellinabox
Debian/Ubuntu
apt install openssl shellinabox
配置 Shellinabox
默认情况下, Shellinabox
的服务绑定在 localhost:4200
, 处于安全原因,默认情况下, 并没有将服务暴露内网,需要根据环境的安全情况,设置对应的发布地址.
RHEL/CentOS
/etc/sysconfig/shellinaboxd
是 Shellinabox
的主配置文件, 将配置内容修改为如下:
# vim /etc/sysconfig/shellinaboxd
# TCP port that shellinboxd's webserver listens on
PORT=4200
# specify the IP address of a destination SSH server
OPTS="-s /:SSH:192.168.56.10"
# if you want to restrict access to shellinaboxd from localhost only
OPTS="-s /:SSH:192.168.56.10 --localhost-only"
Debian/Ubuntu
Debian/Ubuntu
环境下, Shellinabox
的主配置文件为 /etc/default/shellinabox
, 将内容修改为如下
# vim /etc/default/shellinabox
# TCP port that shellinboxd's webserver listens on
SHELLINABOX_PORT=4200
# specify the IP address of a destination SSH server
SHELLINABOX_ARGS="--o-beep -s /:SSH:192.168.56.10"
# if you want to restrict access to shellinaboxd from localhost only
SHELLINABOX_ARGS="--o-beep -s /:SSH:192.168.56.10 --localhost-only"
启动 Shellinabox
Shellinabox
默认安装 Shellinabox
都会添加系统服务, 根据对应系统的服务管理器来管理 Shellinabox
服务
RHEL/CentOS
service shellinaboxd start
Debian/Ubuntu
service shellinabox start
服务启动后, 我们可以验证下服务是否正常运行:
# netstat -nap | grep shellinabox
tcp 0 0 0.0.0.0:4200 0.0.0.0:* LISTEN 14380/shellinaboxd
接下来就可以访问 http://your_ip_address:4200
即可通过浏览器访问 shell
终端.