Start screen sharing remotely in Terminal

Assume you want to do some work on a remote Mac via 10.5's Screen Sharing, but you forgot to enable Screen Sharing before you left the remote Mac. Since the screen sharing system uses launchd to monitor its state, enabling and disabling is as simple as adding a file in the/Libary/Preferences folder.

Of course, this does mean that you will need to have remote Login access to the remote Mac…

$ cd /Library/Preferences

$ echo -n enabled > com.apple.ScreenSharing.launchd

To disable screen sharing:

$ cd /Library/Preferences

$ rm com.apple.ScreenSharing.launchd