0

I have a Linux server I have ssh access on port 8122 but from my current office i can't access this port since it's blocked by the proxy.

Since I don't want to change the port I wanted to know if there's some way to make it so that from a specific IP I can still have ssh access from port 22 while everyone else has to use port 8122

1 Answer 1

4

Assuming Linux on the target (running the SSH server), you could create an iptables DNAT rule that rewrites port 22 to 8122, but only when the source IP is the one you want.

3
  • Yes it's a linux server. Going to try that now, thanks
    – valepu
    Dec 24, 2016 at 8:43
  • iptables -t nat -A PREROUTING -s <IP> -p tcp --dport 22 -j REDIRECT --to-port 8122 is this right?
    – valepu
    Dec 24, 2016 at 9:20
  • Yep, that looks about right to me. Dec 24, 2016 at 23:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .