sh ssh_socks_proxy_server.sh

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh ssh_socks_proxy_server.sh相关的知识,希望对你有一定的参考价值。

#!/bin/bash
#
#------------------------------------------------------------------------------
## DESCRIPTION
#------------------------------------------------------------------------------
# Allows you to quickly setup a server to be used as a SOCKS proxy by forwarding
# SSH ports
#
#------------------------------------------------------------------------------
## USAGE
#------------------------------------------------------------------------------
# Host = 127.0.0.1
# Port = 2434 (in this case)
# Set it as a SOCKSv5 Proxy
#==============================================================================


# ==============================================================================
# Create key pair
# ==============================================================================
ssh-copy-id root@123.456.789


# ==============================================================================
#  Setup SSH tunnet for SOCKS
# ==============================================================================
#   D - port of choice between 1025 and 65536
#   f - run tunnel in background
#   C - compress data
#   q - quiet mode
#   N - no commands are to be executed remotely
ssh -D 2434 -f -C -q -N root@123.456.789


# ==============================================================================
# Test if the tunnel is active
# ==============================================================================
ps aux | grep ssh | grep 2434

# Example output:
#
# test 617 0.0 0.0 49348 2384 ? Ss 10:11 0:00 ssh -D 2434 -f -C -q -N root@1.2.3.4


# ==============================================================================
# Usage
# ==============================================================================
# Host = 127.0.0.1
# Port = 2434 (in this case)
# Set it as a SOCKSv5 Proxy

以上是关于sh ssh_socks_proxy_server.sh的主要内容,如果未能解决你的问题,请参考以下文章

如何使我的命令行在具有扩展名(.sh)和名称如“weird.sh.sh.sh”的文件上工作

sh sh_template.sh

sh sh.sh

Linux下面如何运行 SH文件

配置告警系统主脚本main.sh mon.sh load.sh 502.sh disk.sh

shell 脚本各种执行方式(source ./*.sh, . ./*.sh, ./*.sh)的区别