Mac Terminal view is Screen Sharing is Enabled

Is there a way to use Terminal to check to see if Screen Sharing/Remote Desktop is enabled? Or is there a file which will have a YES/NO of it?

The one catch; it must work without sudo or admin privileges.


You can do so by checking for the existence of the launchd files in /etc:

[[ -f /etc/RemoteManagement.launchd ]] && echo 'enabled' || echo 'disabled'

or for screen sharing:

[[ -f /etc/com.apple.screensharing.agent.launchd ]] && echo 'enabled' || echo 'disabled'

You can check if rfb port is opened (5900) with:

netstat -atp tcp | grep rfb