SSH change default port via ssh.plist

Discussion in 'Mac OS X Server, Xserve, and Networking' started by bartezzini, Apr 22, 2011.

  1. macrumors newbie

    Joined:
    Apr 22, 2011
    #1
    :confused: I have to change SSH default port on Snow Leopard server. There's a hint that works with my home snow leopard but don't work on server why?
    This method edit ssh.plist
    Code:
    <key>Sockets</key>
    <dict>
            <key>Listeners</key>
            <dict>
                    <key>SockServiceName</key>
                    <string>ssh</string>
                    <key>Bonjour</key>
                    <array>
                            <string>ssh</string>
                            <string>sftp-ssh</string>
                    </array>
            </dict>
            <key>Listeners2</key>
            <dict>
                    <key>SockServiceName</key>
                    <string>22022</string>
            </dict>
    </dict>
     
  2. macrumors 68040

    calderone

    Joined:
    Aug 28, 2009
    Location:
    Seattle
    #2
    What is up with the Listeners2?

    You can define the port on the existing listener. For example:

    Code:
    <key>Sockets</key>
            <dict>
                    <key>Listeners</key>
                    <dict>
                            <key>Bonjour</key>
                            <array>
                                    <string>ssh</string>
                                    <string>sftp-ssh</string>
                            </array>
                            <key>SockServiceName</key>
                            <string>22022</string>
                    </dict>
            </dict>
    
    Also, to have it take effect immediately:
    Code:
    sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
    Code:
    sudo launchctl load /System/Library/LaunchDaemons/ssh.plist
     

Share This Page