# SSH 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.&#x20;

The default entries are:&#x20;

{% code title="/etc/services (line 83 & 84)" %}

```
ssh              22/udp     # SSH Remote Login Protocol
ssh              22/tcp     # SSH Remote Login Protocol
```

{% endcode %}

## Resources

{% embed url="<https://www.godo.dev/tutorials/macos-ssh-server-no-password/>" %}
