shellinabox安装和使用(web ssh)

本文详细介绍Shellinabox的安装步骤、配置方法及其在Web浏览器中实现SSH远程登录的功能。Shellinabox是一款用C语言编写的Web终端模拟器,通过Ajax与后端交互。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
我的博客已迁移到xdoujiang.com请去那边和我交流
The shellinaboxd daemon implements a webserver that listens on the specified port.
The web server publishes one or  more  services that will be displayed  in  a VT100 emulator implemented as an AJAX web application. 
By default, the port is 4200 and the default service URL is http: //localhost :4200/.
If no particular service was requested,the server launches  /bin/login  querying the user  for  their username and password.
It  then  starts the user s default login shell.Any modern JavaScript and CSS enabled browser will be able to access the published
service without requiring additional plugins.
Shellinabox是一个基于web的终端模拟器,采用C语言编写,使用Ajax与后端服务通信。
它实现了一个Webserver,默认监听4200端口,在支持Javascript和CSS的浏览器上访问http: //host :4200即可。并且可以配置SSL /TLS 证书,使用https方式加密通信。
 
一、基础环境
1、 cat  /etc/debian_version 
7.8
 
2、 uname  -r
3.2.0-4-amd64
 
3、ip
10.1.10.117
 
二、shellinabox安装
1、直接使用apt-get安装shellinabox
apt-get -y  install  shellinabox
 
2、使用dpkg来查看下一共安装哪些配置文件、命令、文档及路径在哪里
dpkg -L shellinabox
/.
/usr
/usr/bin
/usr/bin/shellinaboxd
/usr/share
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/shellinaboxd .1.gz
/usr/share/doc
/usr/share/doc/shellinabox
/usr/share/doc/shellinabox/changelog .Debian.gz
/usr/share/doc/shellinabox/AUTHORS
/usr/share/doc/shellinabox/TODO
/usr/share/doc/shellinabox/examples
/usr/share/doc/shellinabox/examples/cgi-mode-example .sh
/usr/share/doc/shellinabox/changelog .gz
/usr/share/doc/shellinabox/README
/usr/share/doc/shellinabox/copyright
/usr/share/doc/shellinabox/NEWS .gz
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/shellinabox
/etc
/etc/shellinabox
/etc/shellinabox/options-enabled
/etc/shellinabox/options-enabled/README
/etc/shellinabox/options-available
/etc/shellinabox/options-available/00_White  On Black.css
/etc/shellinabox/options-available/00 +Black on White.css
/etc/shellinabox/options-available/01_Monochrome .css
/etc/shellinabox/options-available/README
/etc/shellinabox/options-available/01 +Color Terminal.css
/etc/default
/etc/default/shellinabox
/etc/init .d
/etc/init .d /shellinabox
/etc/shellinabox/options-enabled/00_White  On Black.css
/etc/shellinabox/options-enabled/00 +Black on White.css
/etc/shellinabox/options-enabled/01_Monochrome .css
/etc/shellinabox/options-enabled/01 +Color Terminal.css
 
3、修改配置
1)先备份下配置文件
cp  /etc/default/shellinabox  /etc/default/shellinabox .bak
2)修改内容
diff  /etc/default/shellinabox  /etc/default/shellinabox .bak
5c5
< SHELLINABOX_PORT=8888
---
> SHELLINABOX_PORT=4200
18c18
< SHELLINABOX_ARGS= "--no-beep -s /:SSH:10.1.10.117"
---
> SHELLINABOX_ARGS= "--no-beep"
3)参数说明
--no-beep   not only are audible signals undesired  in  some working environments,
but browser support  for  media playback is often buggy,too.
Setting this option suppresses all audio playback and enables the visual bell by default.
 
4、重启服务
/etc/init .d /shellinabox  restart
 
5、查看端口和进程
1) netstat  -tupnl| grep  shell
tcp        0      0 0.0.0.0:8888            0.0.0.0:*               LISTEN      17230 /shellinaboxd
2) ps  -ef | grep  shell
102       17230      1  0 00:11 ?        00:00:00  /usr/bin/shellinaboxd  -q --background= /var/run/shellinaboxd .pid -c  /var/lib/shellinabox  -p 8888 -u shellinabox -g shellinabox --user-css Black on White:+ /etc/shellinabox/options-enabled/00 +Black on White.css,White On Black:- /etc/shellinabox/options-enabled/00_White  On Black.css;Color Terminal:+ /etc/shellinabox/options-enabled/01 +Color Terminal.css,Monochrome:- /etc/shellinabox/options-enabled/01_Monochrome .css --no-beep -s /:SSH:10.1.10.117
102       17231  17230  0 00:11 ?        00:00:00  /usr/bin/shellinaboxd  -q --background= /var/run/shellinaboxd .pid -c  /var/lib/shellinabox  -p 8888 -u shellinabox -g shellinabox --user-css Black on White:+ /etc/shellinabox/options-enabled/00 +Black on White.css,White On Black:- /etc/shellinabox/options-enabled/00_White  On Black.css;Color Terminal:+ /etc/shellinabox/options-enabled/01 +Color Terminal.css,Monochrome:- /etc/shellinabox/options-enabled/01_Monochrome .css --no-beep -s /:SSH:10.1.10.117
1
三、web客户端测试

wKioL1Wkq37RqNHOAAJpuO182ng667.jpg

1
2
3
四、参考文章
http: //www .tecmint.com /shell-in-a-box-a-web-based-ssh-terminal-to-access-remote-linux-servers/
https: //github .com /shellinabox/shellinabox









本文转自 xdoujiang 51CTO博客,原文链接:http://blog.51cto.com/7938217/1674056,如需转载请自行联系原作者
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值