Question

Suppose the network is like:

A(192.68.0.1)--------------------B(192.68.0.2)------------------C(192.68.0.3)

A is my ssh server, C is a target ssh server, and I can telnet from A to B(my account is not root).

B is a server not allow ssh login from others, but B can login to C via ssh.

Is it possible to connect C from A through B via ssh?

Was it helpful?

Solution

If you can run programs on B, you can use something like simpleproxy to forward the TCP connection to C.

Then you SSH from A to some port on B (not 22), which will forward your connection to C. Everything will still be encrypted since the SSH session is A<->C.

OTHER TIPS

ok telnet to b you can actually ssh to yourself on b, but the following command may not work but try it first

ssh -L0.0.0.0:2200:192.68.0.3:22 127.0.0.1 ... if sshd is not running on b... then ssh to c

ssh -L0.0.0.0:2200:192.68.0.3:22 192.68.0.3

do a

netstat -an | grep 2200 -- Do this on b (192.68.0.2)

if the netstat has 127.0.0.1 listening on 2200 and not 0.0.0.0 this trick wont work... but if it does... you can then connect to ssh on port 2200 to b and it will hit c

ssh 192.68.0.2:2200

i have you ssh to localhost on b because i cant remember the command to not spawn a shell and im too lazy to look it up... but if the solution above does not work you wont be able to redirect ports with ssh without root, you would have to change the config file on b

you would have to add GatewayPorts yes to the sshd config file in /etc/sshd/conf/sshd_config

http://docstore.mik.ua/orelly/networking_2ndEd/ssh/ch09_02.htm -- this talks all about port forwarding with ssh

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top