SSH on macOS

Configuring and Using OpenSSH on macOS

Restart SSH

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

Custom SSHD Port

Method: /private/etc/services File

The /private/etc/services file on macOS contains the default port mappings for many services, including ssh. SSH ports can be changed by duplicating and commenting out the original Port 22 lines, replacing port 22 with your choice.

The default entries are:

/etc/services (line 83 & 84)
ssh              22/udp     # SSH Remote Login Protocol
ssh              22/tcp     # SSH Remote Login Protocol

Resources

Last updated