The SSH is a little gem for OS X feels-like-hacker users. It allows you to remotely connect to your Mac using another one by entering username and password, in order to access to the system. In this tutorial, we’re going to see how to sleep a Mac using SSH login from Terminal. First of all, you need to enable SSH login on the computer you want to sleep. Just go to System Preferences > Sharing and tick the Remote Login option.
Open the Terminal and type the command using this syntax:
ssh [username]@[IP address]
Replace the [username] with your account username on the computer you want to sleep. If you’re not sure about which is your username, hit Shift+Cmd+H and see your home folder name. Then type its IP address. You can find it in System Preferences > Network, then look at the IP field. Execute the command and, when asked from the Terminal, type “yes” to confirm that you want to connect to the host creating a RSA key.