Enabling SSH Daemon from Terminal (OS X Lion)
enable remote login
systemsetup -setremotelogin on
disable remote login
systemsetup -setremotelogin off
You may have to sudo:
sudo systemsetup -setremotelogin on
I've found terminal WILL ask:
Do you really want to turn remote login off? If you do, you will lose this connection and can only turn it back on locally at the server (yes/no)?
Typing 'yes' in scripts is not always possible. To resolve this, use a -f flag before -setremotelogin, like so:
systemsetup -f -setremotelogin on
systemsetup -f -setremotelogin off