by leif

How can I change which port sshd listens on in Mac OS X 10.3 Panther? (hint: not in sshd_config)

If you check the "Remote Login" box in the Sharing panel in System Preferences on a Mac OS X computer, you will enable the built in OpenSSH server. In previous versions of OS X, you could configure which port it listened on by editing the "Port" line in /etc/sshd_config. In Mac OS X 10.3, sshd is (strangely) run from xinetd, so the Port configuration line no longer has any effect.*

xinetd appears to rely on /etc/services to figure out port numbers, so the easiest way I found to change the ssh port is to change it there. You can view /etc/xinetd.d/ssh, and could possibly add a port line there, but the xinetd.conf man page says "If this attribute is specified for a service listed in /etc/services, it must be equal to the port number listed in that file.". So you may as well just change it in /etc/services I think.

To modify the file in place, you could use this command:

sudo perl -pi -e 's!^(ssh\s+) \d+/!$1 2200/!' /etc/services # changes it to port 2200
Then you need to HUP xinetd:
sudo kill -1 `cat /var/run/xinetd.pid`

*Actually, if you want to start sshd manually, ie not via the Sharing GUI, it will ofcourse run as a daemon and use it's configuration file as expected. But if you do it the way described above, you can still turn ssh on and off with the OS X GUI, and have it started automatically, etc.

 


 
Read more of   The Yak's Frequently Questioned Answers   (mod.2008-06-12)

432.   Who are the Steve Police?   [jake/2006-05-21]
329.   How do I get music for my experimental noise club?   [jake/2002-10-05]
256.   How does the new Windows Product Activation (WPA) scheme work?   [rupe/2001-07-10]
240.   Where can I find black and white photos of people and places in San Francisco?   [rupe/2001-06-05]
181.   Where does the Yak read?   [rupe/2001-06-05]
169.   Where does The YAK go out to eat?   [strick/2001-04-24] ( combee/2001-05-29 )
168.   What's the Official Fag Razor of the YAK?   [strick/2001-01-29]
123.   How do I check for the existence of a file in Python?   [rupe/2000-09-25]
100.   What is WAX?   [rupe/2000-06-10]
78.   Where can I find the latest copy of nmap?   [rupe/2000-04-22]
77.   How do I read from standard input using a Python script?   [rupe/2000-04-21]
73.   How many Zelda games are there?   [vonguard/2001-06-25] ( combee/2001-07-10 mennonite/2001-03-27 )