简单的把过程写一下:
1.备份ssh.plist:
sudo cp /System/Library/LaunchDaemons/ssh.plist /System/Library/LaunchDaemons/ssh.plist.bak
2.编辑/System/Library/LaunchDaemons/ssh.plist 文件,我们看到里面有Sockets这个key:
<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> </dict>
将其中的SockServiceName对应的string:ssh修改为想要的端口即可