What It Does
The script reads whether three remote-access services are running and alerts for each one that is on while its allow input is false. Remote Login is read with systemsetup, and when macOS refuses that without Full Disk Access, the launchd job for SSH is read instead. Screen Sharing is on when its launchd job is loaded. Remote Management, Apple Remote Desktop, is on when the ARDAgent process is running or something listens on TCP port 3283.
If your own support tool is one of these, for example you manage Macs over SSH, set the matching allow input to true so it is reported as on but allowed. It changes nothing. Pair it with disable-mac-remote-access, which turns the services off.
Run it as root, which an RMM does. Without root, Remote Login may be read less reliably, and the script says so in a warning.
Before You Run It
- Set the allow input for any service your own tools use. Otherwise it alerts on them every run.
- Run it as root so Remote Login is read reliably.
- Alert on the exit code in your RMM. An exit of 1 means a service is on that you did not allow.
- To switch a service off, run disable-mac-remote-access as a dry run first.
Type and Risk
- Type: Monitor. It checks one condition. It exits 1 when it finds the problem, so your RMM can alert on it, 0 when all is well, and 2 when it could not run.
- Risk: Low. It reads and changes nothing.
- Restart: It never restarts the machine.
- Typical run: Under 5 seconds.
- Example answer: "Remote Login is on; Screen Sharing is on"
- Tested before listing on macOS 27 (Apple silicon VM) with /bin/bash 3.2, run as root, against its own test cases.
Inputs
Pass an input as an argument (--input-name value), as an environment variable named as listed, which is how most RMMs pass script variables, or change its default in the DEFAULT_ lines near the top of the script. An argument wins over an environment variable, which wins over the default.
- ALLOW_REMOTE_LOGIN: Remote Login (SSH) may be on. Default false.
- ALLOW_SCREEN_SHARING: Screen Sharing may be on. Default false.
- ALLOW_REMOTE_MANAGEMENT: Remote Management (ARD) may be on. Default false.
Every script also takes DRY_RUN, OUTPUT_FORMAT (Text, Answer, Json or Csv), EXPORT_PATH and RESULT_FIELD, which writes the answer to an RMM custom field, unless the list above words one differently.
License
Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.