OS X HowTo:  Change Default SSH Port

OS X likes to ruin the simplicty and functionality that Linux has by taking standards and changing them enough to be illogical and overly complicated.  If you thought it would be as easy as editing /etc/sshd_config like any other self-respecting unix variant, you'd be mistaken.  Here's how to work around OS X's ridiculousness:

  • Open /System/Library/LaunchDaemons/ssh.plist with your editor of choice.
  • Look for this:
<key>SockServiceName</key>
  <string>ssh</string>
  • Change it to this:
<key>SockServiceName</key>
  <string>ssh2</string>
  • Decide what port you'd like to use to accept incoming SSH.
  • Open /etc/services with the editor of your choice.
  • Create these entries:

  ssh2              [yourport]/udp
ssh2              [yourport]/tcp
  • Type "launchctl" into a terminal to re-load launchd