I had a custom port by using the "Port" line in /etc/sshd_config. After updating to Mac OS X 10.12.4 I found I could no longer connect on the custom port – instead it was listening on port 22. I found that my sshd_config had apparently been renamed to sshd_config~previous, so I moved it back to the correct spot and restarted sshd from the command line using sudo launchctl stop com.openssh.sshd; sudo launchctl start com.openssh.sshd
. However, after the restart sshd was still listening on port 22. I then opened System Preferences and under sharing clicked on "Remote Login". Running `netstat -a -n" showed that port 22 was no longer being listened to. I then click on "Remote Login" to restart sshd, and then found sshd was still listening on port 22, not my custom port.
In /var/log/apache2 I see an empty access_log
on startup, and error_log
contains the normal startup message. No clues there.
How do I get sshd to listen on my custom port again?
Best Answer
I found the answer here and it appears to also apply for upgrading to Sierra from a pre-el capitan version of OS X.
To summarize:
Edit /Library/LaunchDaemons/ssh2.plist and change the lines that read:
to:
And change the lines that read:
by replacing "ssh" with whatever port you want to use.
Then start the new port with:
As noted in the article, this doesn't eliminate ssh running on port 22. In my case that was okay - the main reason for running on the new port was to match the port ssh was visible at outside the firewall.