I run SSHd on one of my machines (Remote Administration is what it is called in the OS X preferences) and I would prefer it not run on the default port 22 -- for various reasons. Sure, I know that there is no such thing as security through obscurity, but I would rather not shout to any port scanner out there: "SSH running here!" But also, I am setting up some tunnels for friends and family whose situations preclude them from using port 22.
I have found various discussion searching the net for how to change the default port for sshd, but none of them seemed to work. There is the default port in the /etc/sshd_config file, which is actually ignored unles you invoke sshd MANUALLY. OS X 10.3 actually runs sshd via xinetd. We will not discuss the merits of that here; that is another topic entirely. But if you look in the file /etc/xinetd.d/ssh, you will see a server args value, with a -i variable. Some hints claimed that you could just add the port argument to that (-p [port]). Well, that doesn't work either.
After some messing around I found out why: In Panther, the default sshd port is set in the /etc/services file. In the Terminal (or your favorite command line environment), edit that file using your favorite editor. I use Pico, and you will probably need administrator rights to edit it (using sudo of course, right?). Search for "ssh," which I found between ftp and telnet. The section looked like this:
ftp 21/udp # File Transfer [Control]
ftp 21/tcp # File Transfer [Control]
# Jon Postel <postel@isi.edu>
ssh 22/udp # SSH Remote Login Protocol
ssh 22/tcp # SSH Remote Login Protocol
# Tatu Ylonen <ylo@cs.hut.fi>
telnet 23/udp # Telnet
telnet 23/tcp # Telnet
The 22 listed in the ssh lines is what will be the default sshd port on your machine when you enable "Remote Administration" in system preferences. Change the "22" in those lines to whatever port you would like to use, as such:
ssh 8855/udp # SSH Remote Login Protocol
ssh 8855/tcp # SSH Remote Login Protocol
Then save, and restart sshd with a quick sudo killall -HUP xinetd. Now your SSH server should be running on a new port (other than 22) -- our example used 8855.
Mac OS X Hints
http://hints.macworld.com/article.php?story=20040609190121868