If for any reason you don’t have screen sharing enabled in your Os X remote Mac, you still can enabled it distantly, (under the obvious condition you can ssh to it).
As the screen sharing system uses launchd to monitor its state, enabling and disabling is as simple as adding a file in the remote Mac’s /Libary/Preferences folder.
cd /Library/Preferences echo -n enabled > com.apple.ScreenSharing.launchd
To disable screen sharing:
cd /Library/Preferences $ rm com.apple.ScreenSharing.launchd
If you have a Finder window open with the remote Mac selected in the Shared section, you’ll even note the icon for Screen Sharing coming and going as you do this.
Source : alblue on Os X hints.