Linux-Shell-Web超級終端工具shellinabox

Linux Shell Web超級終端工具shellinaboxcss

ShellLinux內核應用程序,是指「爲使用者提供操做界面」的軟件,也是命令解析器,它相似於Windows操做系統DOS下的cmd.exe應用程序。它接收用戶命令,而後調用相應的應用程序,用戶通常管理Linux服務器都是習慣用putty、Xshell、SecureCRT、secure shell等客戶端端工具,可是使用這些客戶端都是須要在本地安裝後才能使用,若是換其它電腦也是須要從新安裝,這樣很是使用起來很是麻煩,因此,咱們今天就來介紹一塊很是方便的shell客戶端工具,使用系統自帶的瀏覽器來管理Linux服務終端,是一款能隨時在任何終端上面管理,這一款運行在linux下面的工具 shellinabox,只須要在Linux服務器上面安裝並配置好shellinabox。linux

 

shellinabox是由Markus Gutschke建立的基於Web的終端模擬器。它具備內置的Shell Web服務端,在指定端口上做爲基於Web的SSH客戶端運行,並提示您使用任何支持AJAX/JavaScript和CSS的瀏覽器遠程訪問和控制Linux Server SSH Shell,而無需任何其餘瀏覽器插件,使用很是方便,不過安裝和配置是須要有點點Linux基礎,若是以爲本身徹底不懂Linux,能夠建議去購買《Linux就該這麼學》這本教程,很是適合初學者入門,或者去此教程的官網查看詳細的資料,直接在百度輸入此書名就能夠直接進入官網web

 

shellinbox是一款在Linux服務器下有一個內建的web server做爲基本的web ssh client,容許你經過指定的端口訪問linux服務器的ssh shell,只要你的瀏覽器支持AJAX/JS/CSS就能夠訪問,不過如今主流的操做系統自帶的瀏覽器都支持,shellinabox是一款開源的輕量級軟件,在安裝shellinabox以前要肯定Linux服務端是否安裝了openssl庫;debian和ubuntu官方還提供有deb安裝包,而centos也有rpm包,也能夠經過yum源安裝,安裝及配置也比較簡單,下面咱們來詳細的安裝和配置shellinabox。shell

 

1、在RHEL、 CentOS系統上面安裝及配置步驟以下ubuntu

# yum install openssl shellinaboxvim

Loaded plugins: fastestmirrorcentos

Determining fastest mirrors瀏覽器

epel/x86_64/metalink                                                                            | 9.2 kB  00:00:00    服務器

 * base: mirrors.aliyun.comsession

 * epel: mirrors.aliyun.com

 * extras: mirrors.aliyun.com

 * updates: mirrors.aliyun.com

base                                                                                            | 3.6 kB  00:00:00    

epel                                                                                            | 3.2 kB  00:00:00    

extras                                                                                          | 3.4 kB  00:00:00    

updates                                                                                         | 3.4 kB  00:00:00    

(1/6): extras/7/x86_64/primary_db                                                               | 156 kB  00:00:00    

(2/6): base/7/x86_64/group_gz                                                                   | 166 kB  00:00:01    

(3/6): epel/x86_64/updateinfo                                                                   | 940 kB  00:00:08    

(4/6): updates/7/x86_64/primary_db                                                              | 1.3 MB  00:00:10    

(5/6): epel/x86_64/primary                                                                      | 3.6 MB  00:00:21    

(6/6): base/7/x86_64/primary_db                                                                 | 6.0 MB  00:00:26    

epel                                                                                                       12745/12745

Resolving Dependencies

--> Running transaction check

---> Package openssl.x86_64 1:1.0.2k-12.el7 will be updated

---> Package openssl.x86_64 1:1.0.2k-16.el7 will be an update

--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.2k-16.el7 for package: 1:openssl-1.0.2k-16.el7.x86_64

---> Package shellinabox.x86_64 0:2.20-5.el7 will be installed

--> Running transaction check

---> Package openssl-libs.x86_64 1:1.0.2k-12.el7 will be updated

--> Processing Dependency: openssl-libs(x86-64) = 1:1.0.2k-12.el7 for package: 1:openssl-devel-1.0.2k-12.el7.x86_64

---> Package openssl-libs.x86_64 1:1.0.2k-16.el7 will be an update

--> Running transaction check

---> Package openssl-devel.x86_64 1:1.0.2k-12.el7 will be updated

---> Package openssl-devel.x86_64 1:1.0.2k-16.el7 will be an update

--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================

 Package                        Arch                    Version                            Repository             Size

======================================================================================

Installing:

 shellinabox                    x86_64                  2.20-5.el7                         epel                  136 k

Updating:

 openssl                        x86_64                  1:1.0.2k-16.el7                    base                  493 k

Updating for dependencies:

 openssl-devel                  x86_64                  1:1.0.2k-16.el7                    base                  1.5 M

 openssl-libs                   x86_64                  1:1.0.2k-16.el7                    base                  1.2 M

 

Transaction Summary

======================================================================================

Install  1 Package

Upgrade  1 Package (+2 Dependent packages)

 

Total download size: 3.3 M

Is this ok [y/d/N]:y

Downloading packages:

No Presto metadata available for base

(1/4): openssl-1.0.2k-16.el7.x86_64.rpm                                                         | 493 kB  00:00:01    

(2/4): shellinabox-2.20-5.el7.x86_64.rpm                                                        | 136 kB  00:00:01    

(3/4): openssl-devel-1.0.2k-16.el7.x86_64.rpm                                                   | 1.5 MB  00:00:05    

(4/4): openssl-libs-1.0.2k-16.el7.x86_64.rpm                                                    | 1.2 MB  00:00:05    

-----------------------------------------------------------------------------------------------------------------------

Total                                                                                  469 kB/s | 3.3 MB  00:00:07    

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Updating   : 1:openssl-libs-1.0.2k-16.el7.x86_64                                                                 1/7

  Updating   : 1:openssl-1.0.2k-16.el7.x86_64                                                                      2/7

  Installing : shellinabox-2.20-5.el7.x86_64                                                                       3/7

  Updating   : 1:openssl-devel-1.0.2k-16.el7.x86_64                                                                4/7

  Cleanup    : 1:openssl-devel-1.0.2k-12.el7.x86_64                                                                5/7

  Cleanup    : 1:openssl-1.0.2k-12.el7.x86_64                                                                      6/7

  Cleanup    : 1:openssl-libs-1.0.2k-12.el7.x86_64                                                                 7/7

  Verifying  : 1:openssl-libs-1.0.2k-16.el7.x86_64                                                                 1/7

  Verifying  : 1:openssl-devel-1.0.2k-16.el7.x86_64                                                                2/7

  Verifying  : shellinabox-2.20-5.el7.x86_64                                                                       3/7

  Verifying  : 1:openssl-1.0.2k-16.el7.x86_64                                                                      4/7

  Verifying  : 1:openssl-devel-1.0.2k-12.el7.x86_64                                                                5/7

  Verifying  : 1:openssl-1.0.2k-12.el7.x86_64                                                                      6/7

  Verifying  : 1:openssl-libs-1.0.2k-12.el7.x86_64                                                                 7/7

Installed:

  shellinabox.x86_64 0:2.20-5.el7                                                                                     

Updated:

  openssl.x86_64 1:1.0.2k-16.el7                                                                                      

Dependency Updated:

 openssl-devel.x86_64 1:1.0.2k-16.el7                       openssl-libs.x86_64 1:1.0.2k-16.el7                     

Complete!

 

2、配置shellinaboxd

192.168.3.160是SSH服務器IP地址,

# vim /etc/sysconfig/shellinaboxd

# TCP port that shellinboxd's webserver listens on

PORT=6175

# specify the IP address of a destination SSH server

OPTS="-s /:SSH:192.168.3.160" #(https協議)

#OPTS="-t -s /:SSH:192.168.3.160" #(http協議)

# if you want to restrict access to shellinaboxd from localhost only

#下面配置是僅主機訪問,其它主機不能訪問

#OPTS="-s /:SSH:192.168.3.160 --localhost-only"

 

shellinaboxd默認端口是:4200,我這裏修改成6175。

 

Shellinaboxd經常使用參數使用的幫助手冊

# shellinaboxd --help

List of command line options:

  -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: 4200)

  -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

 

3、啓動、中止、自啓動服務

Centos 6

# service shellinaboxd start                   //啓動服務   

# service shellinaboxd stop               //中止服務

# service shellinaboxd restart            //重啓服務

# chkconfig shellinaboxd on               //自啓服務

 

Centos 7

# systemctl start shellinaboxd.service

# systemctl stop shellinaboxd.service

# systemctl restart shellinaboxd.service

# systemctl enable shellinaboxd.service

 

強制關閉 Shellinaboxd

查找到 Shellinaboxd 的進程 pid ,kill 便可

# ps -aux|grep shellinaboxd | grep -v grep | awk ‘{print $1}’

也可在啓動時加上 -p 參數,將進程 pid 保存到指定的文件中,須要關閉時讀取它並進行 kill

 

4、查看服務狀態

# netstat -nap | grep shellinabox

tcp      0      0 0.0.0.0:6175    0.0.0.0:*     LISTEN     118916/shellinaboxd

https://192.168.3.160:6175/

默認60s不登陸自動斷開

登陸成功

退出web Shell終端:

相關文章
相關標籤/搜索