您的位置:首页 > 运维架构 > Shell

shellinabox安装和使用(web ssh)

2015-07-14 14:19 731 查看
我的博客已迁移到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
三、web客户端测试




四、参考文章 http://www.tecmint.com/shell-in-a-box-a-web-based-ssh-terminal-to-access-remote-linux-servers/ https://github.com/shellinabox/shellinabox
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  web ssh shellinabox