Multiple SSH chaining (tsocks, socksify, proxycommand, etc)

Goal : you require to get to "Server B" from the Client "directly" with SSH, SCP.

"Server B" is alongside "Server A". E.g. : they get on the very same subnet, yet just "Server A" is obtainable from the Internet - > so "Server B" is just indirectly accessible.

I recognize just how to make use of tsocks :

install tsocks

yum install tsocks

configure it [by default there is no config documents. ]

vim /etc/tsocks.conf
server =
server_port = 4000

create the ssh passage

ssh -v -fND localhost:4000 [email protected]

check that if it is developed

ps aux | fgrep -i ssh
USER      8894  0.0  0.0   9780   708 ?        Ss   11:58   0:00 ssh -v -fND localhost:4000 [email protected]
netstat -tulpn | fgrep -i ssh
tcp        0      0    *                   LISTEN      8894/ssh

just how to make use of tsocks

tsocks ssh [email protected]

eliminate the ssh passage

kill `pgrep -f 'D localhost:4000'`

The entire point is totally ALRIGHT to me. Fine.

The Question : How can I make use of numerous ssh passages with as an example : tsocks?
I suggest I need to make use of numerous ssh passages (on various ports certainly) .
How can I set as an example : tsocks to "memorize" numerous ssh passages (ports)?

The "/etc/tsocks. conf" documents just permits one web server, that is alright, due to the fact that If I ssh passage to someplace I need to go via, yet I require extra ports, due to the fact that 1 port = 1 ssh passage. Numerous ssh passages can not bind to 1 port.
I'm making use of Fedora 14 for "Desktop PC"

Thank you!

2019-12-02 03:12:12
Source Share
Answers: 1

tsocks permits numerous SOCKS solutions, you set it approximately make use of a various SOCKS solution (i.e. various ssh -D paying attention on a various port) for each and every wanted target. man tsocks.conf for even more information.

thinking /etc/tsocks.conf having :

path {
    server = localhost
    server_port = 1081
    reaches = <ip-address-of-server-b>/32
path {
    server = localhost
    server_port = 1082
    reaches = <ip-address-of-server-d>/32

Then you would certainly run

ssh -fND :1081 server-a & sleep 1 ; tsocks ssh server-b
ssh -fND :1082 server-c & sleep 1 ; tsocks ssh server-d
2019-12-03 05:05:43