
正文
linux下安装shellinabox实现web登录服务器
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
GitHub地址(含有文件下载和详细安装流程):https://github.com/shellinabox/shellinabox这里我们使用的是redhat安装方法如下:1.配置安装依赖环境yum install git openssl-devel pam-devel zlib-devel autoconf automake libtool
2.下载shellinabox包,开始安装(1)git远程获取,克隆源文件到项目目录
git clone https://github.com/shellinabox/shellinabox.git && cd shellinabox
(2)在页面下载zip文件,上传至服务器。
unzip shellinabox-master.zip
cd shellinabox-master
(3)在项目目录中运行自动工具
autoreconf -i
(4)编译运行配置文件(可设置项目存放位置)
./configure
./configure --prefix=/usr/local/shellinabox#设置项目存放位置
(5)执行安装程序
make && make install
3.进行测试(1)启动程序(需要在管理员下启动,不然所有用户都无法登录)
[root@redhat2 bin]# cd /usr/local/shellinabox/bin
[root@redhat2 bin]# ./shellinaboxd -t#默认是开启在4200端口-b #后台启动 -p #设置端口
-b, --background[=PIDFILE] run in background
-c, --cert=CERTDIR set certificate dir (default: $PWD)
--cert-fd=FD set certificate file from fd
--css=FILE attach contents to CSS style sheet
--cgi[=PORTMIN-PORTMAX] run as CGI
-d, --debug enable debug mode
-f, --static-file=URL:FILE serve static file from URL path
-g, --group=GID switch to this group (default: nobody)
-h, --help print this message
--linkify=[none|normal|aggressive] default is "normal"
--localhost-only only listen on 127.0.0.1
--no-beep suppress all audio output
-n, --numeric do not resolve hostnames
-m, --messages-origin=ORIGIN allow iframe message passing from origin
--pidfile=PIDFILE publish pid of daemon process
-p, --port=PORT select a port (default: )
-s, --service=SERVICE define one or more services
-t, --disable-ssl disable transparent SSL support
--disable-ssl-menu disallow changing transport mode
--disable-utmp-logging disable logging to utmp and wtmp
-q, --quiet turn off all messages
--unixdomain-only=PATH:USER:GROUP:CHMOD listen on unix socket
-u, --user=UID switch to this user (default: nobody)
--user-css=STYLES defines user-selectable CSS options
-v, --verbose enable logging messages
--version prints version information
--disable-peer-check disable peer check on a session
所有参数
(2)可以查看程序运行端口
[root@redhat2 ~]# netstat -tulnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0.0.0.0: 0.0.0.0:* LISTEN /./shellinabox
(3)可能此时在主机上,依旧无法访问,需要配置防火墙
0.查看防火墙状态
/etc/init.d/iptables status
1.设置防火墙:
[root@redhat2 crazyeye]# /sbin/iptables -I INPUT -p tcp --dport 4200 -j ACCEPT#允许8080端口数据访问
[root@redhat2 crazyeye]# /etc/init.d/iptables save#保存配置
iptables: Saving firewall rules to /etc/sysconfig/iptables: [ OK ]
2.临时关闭防火墙
/etc/init.d/iptables stop
3.永久关闭,不随着我们下一次重启而启动
chkconfig --level 35 iptables off
chkconfig iptables off
(4)成功访问
1.配置安装依赖环境yum install git openssl-devel pam-devel zlib-devel autoconf automake libtool
2.下载shellinabox包,开始安装(1)git远程获取,克隆源文件到项目目录
git clone https://github.com/shellinabox/shellinabox.git && cd shellinabox
(2)在页面下载zip文件,上传至服务器。
unzip shellinabox-master.zip
cd shellinabox-master
(3)在项目目录中运行自动工具
autoreconf -i
(4)编译运行配置文件(可设置项目存放位置)
./configure
./configure --prefix=/usr/local/shellinabox#设置项目存放位置
(5)执行安装程序
make && make install
3.进行测试(1)启动程序(需要在管理员下启动,不然所有用户都无法登录)
[root@redhat2 bin]# cd /usr/local/shellinabox/bin
[root@redhat2 bin]# ./shellinaboxd -t#默认是开启在4200端口-b #后台启动 -p #设置端口
-b, --background[=PIDFILE] run in background
-c, --cert=CERTDIR set certificate dir (default: $PWD)
--cert-fd=FD set certificate file from fd
--css=FILE attach contents to CSS style sheet
--cgi[=PORTMIN-PORTMAX] run as CGI
-d, --debug enable debug mode
-f, --static-file=URL:FILE serve static file from URL path
-g, --group=GID switch to this group (default: nobody)
-h, --help print this message
--linkify=[none|normal|aggressive] default is "normal"
--localhost-only only listen on 127.0.0.1
--no-beep suppress all audio output
-n, --numeric do not resolve hostnames
-m, --messages-origin=ORIGIN allow iframe message passing from origin
--pidfile=PIDFILE publish pid of daemon process
-p, --port=PORT select a port (default: )
-s, --service=SERVICE define one or more services
-t, --disable-ssl disable transparent SSL support
--disable-ssl-menu disallow changing transport mode
--disable-utmp-logging disable logging to utmp and wtmp
-q, --quiet turn off all messages
--unixdomain-only=PATH:USER:GROUP:CHMOD listen on unix socket
-u, --user=UID switch to this user (default: nobody)
--user-css=STYLES defines user-selectable CSS options
-v, --verbose enable logging messages
--version prints version information
--disable-peer-check disable peer check on a session
所有参数
(2)可以查看程序运行端口
[root@redhat2 ~]# netstat -tulnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0.0.0.0: 0.0.0.0:* LISTEN /./shellinabox
(3)可能此时在主机上,依旧无法访问,需要配置防火墙
0.查看防火墙状态
/etc/init.d/iptables status
1.设置防火墙:
[root@redhat2 crazyeye]# /sbin/iptables -I INPUT -p tcp --dport 4200 -j ACCEPT#允许8080端口数据访问
[root@redhat2 crazyeye]# /etc/init.d/iptables save#保存配置
iptables: Saving firewall rules to /etc/sysconfig/iptables: [ OK ]
2.临时关闭防火墙
/etc/init.d/iptables stop
3.永久关闭,不随着我们下一次重启而启动
chkconfig --level 35 iptables off
chkconfig iptables off
(4)成功访问
yum install git openssl-devel pam-devel zlib-devel autoconf automake libtool
(1)git远程获取,克隆源文件到项目目录
git clone https://github.com/shellinabox/shellinabox.git && cd shellinabox
(2)在页面下载zip文件,上传至服务器。
unzip shellinabox-master.zip
cd shellinabox-master
(3)在项目目录中运行自动工具
autoreconf -i
(4)编译运行配置文件(可设置项目存放位置)
./configure
./configure --prefix=/usr/local/shellinabox#设置项目存放位置
(5)执行安装程序
make && make install
3.进行测试(1)启动程序(需要在管理员下启动,不然所有用户都无法登录)
[root@redhat2 bin]# cd /usr/local/shellinabox/bin
[root@redhat2 bin]# ./shellinaboxd -t#默认是开启在4200端口-b #后台启动 -p #设置端口
-b, --background[=PIDFILE] run in background
-c, --cert=CERTDIR set certificate dir (default: $PWD)
--cert-fd=FD set certificate file from fd
--css=FILE attach contents to CSS style sheet
--cgi[=PORTMIN-PORTMAX] run as CGI
-d, --debug enable debug mode
-f, --static-file=URL:FILE serve static file from URL path
-g, --group=GID switch to this group (default: nobody)
-h, --help print this message
--linkify=[none|normal|aggressive] default is "normal"
--localhost-only only listen on 127.0.0.1
--no-beep suppress all audio output
-n, --numeric do not resolve hostnames
-m, --messages-origin=ORIGIN allow iframe message passing from origin
--pidfile=PIDFILE publish pid of daemon process
-p, --port=PORT select a port (default: )
-s, --service=SERVICE define one or more services
-t, --disable-ssl disable transparent SSL support
--disable-ssl-menu disallow changing transport mode
--disable-utmp-logging disable logging to utmp and wtmp
-q, --quiet turn off all messages
--unixdomain-only=PATH:USER:GROUP:CHMOD listen on unix socket
-u, --user=UID switch to this user (default: nobody)
--user-css=STYLES defines user-selectable CSS options
-v, --verbose enable logging messages
--version prints version information
--disable-peer-check disable peer check on a session
所有参数
(2)可以查看程序运行端口
[root@redhat2 ~]# netstat -tulnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0.0.0.0: 0.0.0.0:* LISTEN /./shellinabox
(3)可能此时在主机上,依旧无法访问,需要配置防火墙
0.查看防火墙状态
/etc/init.d/iptables status
1.设置防火墙:
[root@redhat2 crazyeye]# /sbin/iptables -I INPUT -p tcp --dport 4200 -j ACCEPT#允许8080端口数据访问
[root@redhat2 crazyeye]# /etc/init.d/iptables save#保存配置
iptables: Saving firewall rules to /etc/sysconfig/iptables: [ OK ]
2.临时关闭防火墙
/etc/init.d/iptables stop
3.永久关闭,不随着我们下一次重启而启动
chkconfig --level 35 iptables off
chkconfig iptables off
(4)成功访问
[root@redhat2 bin]# cd /usr/local/shellinabox/bin
[root@redhat2 bin]# ./shellinaboxd -t#默认是开启在4200端口-b #后台启动 -p #设置端口
-b, --background[=PIDFILE] run in background
-c, --cert=CERTDIR set certificate dir (default: $PWD)
--cert-fd=FD set certificate file from fd
--css=FILE attach contents to CSS style sheet
--cgi[=PORTMIN-PORTMAX] run as CGI
-d, --debug enable debug mode
-f, --static-file=URL:FILE serve static file from URL path
-g, --group=GID switch to this group (default: nobody)
-h, --help print this message
--linkify=[none|normal|aggressive] default is "normal"
--localhost-only only listen on 127.0.0.1
--no-beep suppress all audio output
-n, --numeric do not resolve hostnames
-m, --messages-origin=ORIGIN allow iframe message passing from origin
--pidfile=PIDFILE publish pid of daemon process
-p, --port=PORT select a port (default: )
-s, --service=SERVICE define one or more services
-t, --disable-ssl disable transparent SSL support
--disable-ssl-menu disallow changing transport mode
--disable-utmp-logging disable logging to utmp and wtmp
-q, --quiet turn off all messages
--unixdomain-only=PATH:USER:GROUP:CHMOD listen on unix socket
-u, --user=UID switch to this user (default: nobody)
--user-css=STYLES defines user-selectable CSS options
-v, --verbose enable logging messages
--version prints version information
--disable-peer-check disable peer check on a session
所有参数
[root@redhat2 ~]# netstat -tulnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0.0.0.0: 0.0.0.0:* LISTEN /./shellinabox
/etc/init.d/iptables status
[root@redhat2 crazyeye]# /sbin/iptables -I INPUT -p tcp --dport 4200 -j ACCEPT#允许8080端口数据访问
[root@redhat2 crazyeye]# /etc/init.d/iptables save#保存配置
iptables: Saving firewall rules to /etc/sysconfig/iptables: [ OK ]
/etc/init.d/iptables stop
chkconfig --level 35 iptables off
chkconfig iptables off

推文:Shellinabox:基于 Web 的远程 Terminal 模拟器安装使用详解
4.使用iframe嵌入页面(1)补充:一般设置div高度自适应方法
style="height:0;padding-bottom:100%"
(2)在使用shellinabox的web页面时使用iframe嵌入(不需要指定高度)
<div id="page-content">
<div class="row">
<div class="col-lg-12">
<iframe src="http://192.168.218.129:4200/" width="100%" style="padding-bottom:100%;background-color:white;"></iframe>
</div>
</div>
</div>
(3)实现效果
style="height:0;padding-bottom:100%"
<div id="page-content">
<div class="row">
<div class="col-lg-12">
<iframe src="http://192.168.218.129:4200/" width="100%" style="padding-bottom:100%;background-color:white;"></iframe>
</div>
</div>
</div>







