Web形式的SSH界面Shellinabox简单实用指南

使用shellinabox可以快速建立一个web形式的SSH连接器,使用浏览器访问HOST:PORT即可快速登陆SSH。

在Cent OS 7 中使用yum可以方便地安装shellinabox。

sudo yum install -y shellinabox

使用yum安装的shellinabox的配置文件是 /etc/sysconfig/shellinaboxd

使用vi编辑打开它。默认端口号是4200,建议更改一下端口号,以免被暴力破解:

# Shell in a box daemon configuration
# For details see shellinaboxd man page

# Basic options
USER=shellinabox
GROUP=shellinabox
CERTDIR=/var/lib/shellinabox
PORT=8200
OPTS="--disable-ssl-menu -s /:LOGIN"

CERTDIR=/var/lib/shellinabox
PORT=8200
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"

看得出来它也支持ssl加密连接。

但是这个时候没有开发防火墙端口,是无法访问的,使用以下命令开启防火墙4200或者你改过的端口:

firewall-cmd --zone=public --add-port=4200/tcp --permanent

还有一种方法可以尝试,就是针对服务开启防火墙而不是针对端口:

firewall-cmd --permanent --add-service=shellinaboxd

还有另外的方法,不必开启防火墙的端口,而直接使用nginx代理转发web请求。参考nginx 反向代理其他web服务的基本配置