Reputation: 1056
I have 3 workstations
On idra:
ssh -L 9999:idra:22 cerberouser@cerbero
On otro:
ssh idrauser@idra -p 9999
ssh: connect to host idra port 9999: Connection refused
I cannot modify the sshd_config in ortro. I need to setup a tunnel between idra and cerbero and then use it from ortro
Thanks a lot Riccardo
Upvotes: 0
Views: 3579
Reputation: 9402
These days SSH has specific shortcuts for host jumping. See an example.
ssh -J idrauser@idra cerberouser@cerbero
Or in SSH Config (just your local ~/.ssh/config
one, not SSHD Config)
Host cerbero
User cerberouser
ProxyJump idra
Host idra
User idrauser
and ssh cerbero
.
Upvotes: 0
Reputation: 47062
-L
binds to localhost by default.
Use
ssh -L '*':9999:idra:22 cerberouser@cerbero
or
ssh -o GatewayPorts=yes -L 9999:idra:22 cerberouser@cerbero
instead.
A more secure solution would not proxy the port, but instead proxy the connection. Try adding this to your ~/.ssh/config
on ortro:
Host cerbero
User cerberouser
ProxyCommand /usr/bin/ssh idrauser@idra /bin/nc -w 3700 %h %p
Then connect to cerbero from ortro by running the single command
ssh cerbero
Upvotes: 4