We are implementing a "home made" solution so our AD students can login into specific Macs on specific time remotely using Screen Sharing.
In order to complete our solution, we thought on activating Screen Sharing (not ARD) on specific hours by sending scripts to activate/deactivate Screen Sharing.
We haven't found the command lines to add users/groups to the "only these users" menu.
Yes, it is easy to do it with ARD (ARDAgent / kickstart), but we need to use Screen Sharing.
Anyone knows the commands to set specific users to use Screen Sharing ?
Solved
Set specific users to use Screen Sharing (through command lines)

Best answer by MacConsultant
Ok, so...
Need to set Screen Sharing permissions to Only these users , which will create the access group com.apple.access_screensharing . You can do it using the graphic interface, or, with
dseditgroup -o create -q com.apple.access_screensharing
Add members to the access group com.apple.access_screensharing
Local user:
dseditgroup -o edit -a *LocalUserName* -t user com.apple.access_screensharing
Local group:
dseditgroup -o edit -a *LocalUserGroup* -t group com.apple.access_screensharing
Domain group:
dseditgroup -o edit -a "*DomainName**DomainGroupName*" -t group com.apple.access_screensharing
Domain user:
dseditgroup -o edit -a "*DomainName**DomainUserName*" -t user com.apple.access_screensharing
Also, if you want to check what are the members of com.apple.access_screensharing
dscl -f "/var/db/dslocal/nodes/Default" localonly -read /Local/Target/Groups/com.apple.access_screensharing
Set Screen Sharing back to All users , delete de group com.apple.access_screensharing
dseditgroup -o delete -t group com.apple.access_screensharing > /dev/null
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.