Change OS X's ssh Port
2010/03/19OS X is a Unix system. However, it’s a heavily-modified Unix system, and in most cases this means most things are done just differently enough to be frustrating, and to render most of the *nix how-tos out there useless.
On OS X, ssh (or sshd, rather) is a service managed by launchd. This means that in order to change sshd’s port you can’t just edit sshd’s configuration file at /etc/sshd_config, as is the standard. You actually have to change the file at /System/Library/LaunchDaemons/ssh.plist. Add the following lines:
<key>SockServiceName</key>
<string>ssh2</string>
This will register a new service to be managed by launchd. Now you can go add your new service to /etc/services, where <port#> is the port on which you want to run sshd:
ssh2 <port#>/udp
ssh2 <port#>/tcp
And finally, copy the file /System/Library/LaunchDaemons/ssh.plist to /System/Library/LaunchDaemons/ssh2.plist and change it as follows:
<key>Label</key>
<string>com.openssh.sshd2</strong>
Reboot, forward the port at your router, and you’re good to go.