在不少堡壘機、IT審計等平臺中,基本上都會帶上一個web版的ssh,實現了用戶能在web界面對服務器進行shell操做。又或者咱們在防火牆後面不能使用這些工具訪問遠程系統,或者防火牆只容許HTTPS流量才能經過。那咱們怎麼才能對服務器進行操做呢?css
是由Markus Gutschke開發的一款自由開源的基於Web的Ajax的終端模擬器。使用shellainbox不須要安裝任何相似於 XShell 或 Putty 的通信工具,也不用安裝任何插件或第三方應用軟件,你只須要有一個支持 JavaScript 和 CSS 的現代瀏覽器,經過Web瀏覽器提供了相似原生的 Shell 的外觀和感覺。shellinaboxd守護進程實現了一個Web服務器,可以偵聽指定的端口。可是,這並不必定是一個安全的軟件,我不建議在公網上將其暴露出來。nginx
本文以centos 7.5爲例web
使用yum安裝sql
[root@yunwsn /]# yum install shellinabox -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package shellinabox.x86_64 0:2.20-5.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================
Package Arch Version Repository Size
====================================================================================
Installing:
shellinabox x86_64 2.20-5.el7 epel 136 k
Transaction Summary
====================================================================================
Install 1 Package
Total download size: 136 k
Installed size: 503 k
Downloading packages:
shellinabox-2.20-5.el7.x86_64.rpm | 136 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : shellinabox-2.20-5.el7.x86_64 1/1
Verifying : shellinabox-2.20-5.el7.x86_64 1/1
Installed:
shellinabox.x86_64 0:2.20-5.el7
Complete!
[root@yunwsn /]#
啓動服務shell
[root@yunwsn /]# systemctl start shellinaboxd.service
[root@yunwsn /]# systemctl status shellinaboxd.service
● shellinaboxd.service - Shell In A Box daemon
Loaded: loaded (/usr/lib/systemd/system/shellinaboxd.service; disabled; vendor preset: disabled)
Active: active (running) since Mon 2019-06-03 14:23:54 CST; 7s ago
Docs: man:shellinaboxd(1)
Main PID: 30454 (shellinaboxd)
CGroup: /system.slice/shellinaboxd.service
├─30454 /usr/sbin/shellinaboxd -u shellinabox -g shellinabox --cert=/v...
└─30455 /usr/sbin/shellinaboxd -u shellinabox -g shellinabox --cert=/v...
查看端口centos
[root@yunwsn /]# netstat -natlp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 876/sshd
tcp 0 0 0.0.0.0:4200 0.0.0.0:* LISTEN 30454/shellinaboxd
能夠看到默認端口是4200瀏覽器
使用網頁打開https://ip:4200(注意:必定是https打開)安全
登陸(注意,不支持root用戶登陸,只能使用普通用戶登陸)ruby
修改配置文件,修改PORT便可服務器
vi /etc/sysconfig/shellinaboxd
# Basic options
USER=shellinabox
GROUP=shellinabox
CERTDIR=/var/lib/shellinabox
PORT=443
OPTS="--disable-ssl-menu -s /:LOGIN"
重啓服務
systemctl restart shellinaboxd.service
查看端口
tcp 0 0 10.104.145.137:443 116.21.13.32:39703 ESTABLISHED 31255/shellinaboxd
完
微信公衆號~運維少年