Change the SSH Listening Port Leopard 10.5

If you need to change the firewall port on SSHD for MacOSX Leopard 10.5

Follow the instructions below

Open Terminal and as edit the file /etc/services (as root)

sudo pico /etc/services

Scroll right down to the bottom and add the line

secret-ssh portnumber/tcp # secret SSH port

portnumber being your desired port number, when this has been added press ctrl & o and write the file out and then ctrl & x to exit

Now you will need to edit the file /System/Library/LaunchDaemons/ssh.plist

sudo pico /System/Library/LaunchDaemons/ssh.plist

Now locate the following

<key>SockServiceName <key>

<string>ssh</string>

and replace with this

<key>SockServiceName</key>

<string>secret-ssh</string>

Reboot & you should be able to connect via SSH using your desired port.

This has worked 100% fine for me let me know if you have any trouble

3 Responses to Change the SSH Listening Port Leopard 10.5

  1. matt says:

    should one be concerned with simply changing the default port 22 in /etc/services? then you don’t have to change the ssh.plist …

  2. Marvin says:

    Not really concerned about it, the guide above works great and is exactly what I was looking for!

    Excellent post!

  3. Michael Rush says:

    A restart isn’t required. You also just do:

    sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
    sudo launchctl load /System/Library/LaunchDaemons/ssh.plist

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>