用shellinabox实现web端进行ssh登陆

大家经常使用的ssh工具,基本都是putty或xhell。今天介绍一下另一个ssh登陆方法,用shellinabox来实现web端ssh登陆。

shellinabox的安装

On Debian, Ubuntu and Linux Mint

1
sudo apt-get install shellinabox

On RHEL, CentOS and Fedora

1
yum install openssl shellinabox

设置:

在debian,ubuntu and Linux Mint环境下。配置文件/etc/default/shellinabox

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Should shellinaboxd start automatically
SHELLINABOX_DAEMON_START=1

# TCP port that shellinboxd's webserver listens on
SHELLINABOX_PORT=4200 #这个就是你使用web终端登陆的端口

# Parameters that are managed by the system and usually should not need
# changing:
# SHELLINABOX_DATADIR=/var/lib/shellinabox
# SHELLINABOX_USER=shellinabox
# SHELLINABOX_GROUP=shellinabox

# Any optional arguments (e.g. extra service definitions). Make sure
# that that argument is quoted.
#
# Beeps are disabled because of reports of the VLC plugin crashing
# Firefox on Linux/x86_64.
SHELLINABOX_ARGS="--no-beep"

在RHEL, CentOS and Fedora环境下,配置文件在:/etc/sysconfig/shellinaboxd
因为我电脑没有装centos。下面的代码是我贴来的,不过大至都差不多。

1
2
3
4
5
6
7
8
9
# vi /etc/sysconfig/shellinaboxd
# TCP port that shellinboxd's webserver listens on
PORT=6175 #这个就是你使用web终端登陆的端口

# specify the IP address of a destination SSH server
OPTS="-s /:SSH:172.16.25.125"

# if you want to restrict access to shellinaboxd from localhost only
OPTS="-s /:SSH:172.16.25.125 --localhost-only"

启动服务

Debian, Ubuntu and Linux Mint

1
/etc/init.d/shellinabox start

RHEL and CentOS

1
systemctl shellinaboxd start

检查是否启动

1
2
# netstat -nap | grep shellinabox
tcp 0 0 0.0.0.0:4200 0.0.0.0:* LISTEN 12274/shellinaboxd


使用方法

在任意浏览器中输入https://你的IP:端口号,就可以访问你的linux了。


-------------本文结束 感谢您的阅读-------------
-------------如果觉得这篇文章不错,可以请作者喝杯咖啡!-------------