歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> SHELL編程 >> RHEL6 配置shellinabox遠程Terminal 模擬器

RHEL6 配置shellinabox遠程Terminal 模擬器

日期:2017/2/28 16:23:54   编辑:SHELL編程

Shellinabox 是一個利用 Ajax 技術構建的基於 Web 的遠程Terminal 模擬器,也就是說安裝了該軟件之後,不需要開啟 ssh服務,通過 Web 網頁就可以對遠程主機進行維護操作了,出於安全考慮, Shellinabox 默認強制使用了https協議,這是個挺有趣的技術,因而就在rhel6上面折騰了下,下面記錄了主要的操作步驟

一:編譯安裝Shellinabox
[root@rhel6 ~]# cd /usr/local/src/tarbag/
[root@rhel6 tarbag]# wgethttp://shellinabox.googlecode.com/files/shellinabox-2.10.tar.gz
[root@rhel6 tarbag]# tar -zxvf shellinabox-2.10.tar.gz -C ../software/
[root@rhel6 tarbag]# cd ../software/shellinabox-2.10/
[root@rhel6 shellinabox-2.10]# ./configure --prefix=/usr/local/shellinabox
[root@rhel6 shellinabox-2.10]# make && make install

二:試啟動Shellinabox,可以加上--help參數查看啟動選項,這裡可以看到默認Shellinabox采用https方式啟動
[root@rhel6 ~]# /usr/local/shellinabox/bin/shellinaboxd
Cannot read valid certificate from "certificate.pem". Check file permissions and file format.

[root@rhel6 ~]# /usr/local/shellinabox/bin/shellinaboxd -b -t //-b選項代表在後台啟動,-t選項表示不使用https方式啟動,默認以nobody用戶身份,監聽TCP4200端口

[root@rhel6 ~]# netstat -ntpl |grep shell
tcp 0 0 0.0.0.0:4200 0.0.0.0:* LISTEN 16823/shellinaboxd

[root@rhel6 ~]# killall shellinaboxd


三:生成pem證書,以https方式啟動,pem證書的格式為公鑰加私鑰,並以x509的格式進行打包
[root@rhel6 ~]# openssl genrsa -des3 -out my.key 1024
[root@rhel6 ~]# openssl req -new -key my.key -out my.csr
[root@rhel6 ~]# cp my.key my.key.org
[root@rhel6 ~]# openssl rsa -in my.key.org -out my.key
[root@rhel6 ~]# openssl x509 -req -days 3650 -in my.csr -signkey my.key -out my.crt
[root@rhel6 ~]# cat my.crt my.key > certificate.pem

[root@rhel6 ~]# /usr/local/shellinabox/bin/shellinaboxd -c /root -u root -b //-c參數指定pem證書目錄,默認證書名為certificate.pem,-u 選項指定啟動的用戶身份
[root@rhel6 ~]# netstat -ntpl |grep 4200
tcp 0 0 0.0.0.0:4200 0.0.0.0:* LISTEN 26445/shellinaboxd

[root@rhel6 ~]# ps -ef |grep shell
root 26445 1 0 14:03 ? 00:00:00 /usr/local/shellinabox/bin/shellinaboxd -c /root -u root -b
root 26446 26445 0 14:03 ? 00:00:00 /usr/local/shellinabox/bin/shellinaboxd -c /root -u root -b

Copyright © Linux教程網 All Rights Reserved