So, I've been trying to understand networks a little better and I'm playing around with ssh. I've learned how to set up port forwarding from my AirPort Express directly to my computer, but I am confused on how I am supposed to change the port that is used to accept ssh traffic by the router.

When I set up the port forwarding to my static IP address, I also wanted to change which port the router uses to accept ssh traffic. However, each time I change the public and private TCP ports on the base station and try to connect with ssh by specifying the router port-something like ssh [email protected] -p 1234-I get a connection refused.

Here is my question. How do I change the port that accepts ssh traffic for the AirPort Express router, and if I change that port and the port accepted on my computer, how do I specify the particular port for the router and the particular port accepted by my computer in the ssh command?

Both the AirPort Express and my computer are currently accepting ssh traffic on port 22 (when I have remote login activated, that is). I am trying to change each of these to a different port.

  • 1
    As already said, the question would be easier to answer if you could add a screenshot of Airport Utility showing the configuration you did.
    – nohillside
    Jun 13, 2016 at 14:42
  • Or at least give a textual representation of the ports configured/used on the Airport and the port ssh is listening on on your Mac. Without such details it's impossible to say whether you just got the configuration wrong (and where) or whether there are bigger problems.
    – nohillside
    Jun 13, 2016 at 14:55

1 Answer 1


I think you're trying to set up port forwarding, to allow yourself to ssh in from outside, and changing the port to keep it slightly more secure? You don't need to change the port used internally (inside your network) - you just need to change the port used from outside of your network. Then, set up a rule that passes connections on the desired port to the internal. You would for example tell the router that incoming connections on port 1234 should be redirected inside your network to the machine at on port 22. There are some instructions here that might help. (I don't have an AirPort but have set up port forwarding for multiple routers - the basic idea is the same for all)

Asking your computer to accept incoming ssh on another port is more complicated, and (as of El Capitan) apparently requires deactivation of SIP, which is why it may simply be easier to set the AirPort to forward to port 22 by default.

You must log in to answer this question.

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