Command Line - Enable Remote Login and Remote Management
Modifying remote login and remote management settings is done with two different commands - both executed as root: 


systemsetup 
kickstart


To enable remote login for members of the admin group enter:

sudo systemsetup -setremotelogin on


To restrict access use dseditgroup. First check if it exists and add it if necessary:

dseditgroup com.apple.access_ssh
dseditgroup -o create -q com.apple.access_ssh


and add a user group:

sudo dseditgroup -o edit -a admin -t group com.apple.access_ssh


To enable remote management for admin users enter:

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -users admin -privs -all -restart -agent -menu


To check other options enter:

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart --help