It’s more efficient to shut down or restart a Mac remotely than to physically access the device, in situations where the uncooperative computer is physically far away from you, for example, in a different building from your office or on a different floor from your House.
Remote access to a Mac
To use remote access to control your Mac, all computers must be Macs and connected to the same local network as your home or business. (You can still use Internet connections, and also Windows or Linux-based PCs, but the process differs from what we describe below.)
Two methods to remotely access a Mac
No vendor-supplied application or special hardware device is required; you already have everything you need installed and ready to be used on your Mac.
The first method uses the Mac’s built-in virtual network computing server, which is commonly called screen sharing on the Mac . The second method uses Terminal and its support for Secure Shell, a network protocol that supports secure encrypted remote access to a device.
Screen sharing to remotely shut down or restart a Mac
Although the Mac has native support for screen sharing, this feature is turned off by default. It must be enabled using Sharing preferences. Turn on the Mac’s VNC server to enable Mac screen sharing. When it’s on, connect to remote desktop to take control of your Mac. You only need to turn it on once, on the Mac you want to access remotely.
Once the connection is established, the Mac you’re accessing will display its desktop on the Mac you’re sitting on. You can use the remote Mac as if you were sitting in front of it, including selecting the Shut Down or Restart command from the Apple menu.
Using remote login (SSH) to shut down or restart a Mac
The second option to take control of the Mac is to use the remote login features. As with screen sharing, this feature is disabled and must be enabled before you can use it.
- Start System Preferences , either by clicking the System Preferences icon in the Dock or by choosing System Preferences from the Apple menu.
- In the System Preferences window , select the Share Preference panel .
- In the list of services, place a check mark in the Remote Login box to enable remote login options and view who can connect to your Mac. Limit access to yourself and any administrator-level accounts you’ve created on your Mac.
- Select the Allow access for: Only these users option .
- You should see your user account listed, as well as the Administrators group. This default list of who can connect should be enough; if you want to add another person, click the plus sign at the bottom of the list to add more user accounts.
- Before you leave the Share Preference preferences pane , type the IP address of the remote Mac. You will find the IP address in the text displayed above the list of users allowed to login.
- To log in to this computer remotely, type ssh username@IPaddress. An example would be:
[email protected]
- The sequence of numbers is the IP address of the Mac in question. Remember, your IP will be different than the example above.
- After signing in, to shut down the remote Mac, type
sudo shutdown -h now>
to immediately shut down the computer, or type
sudo shutdown -r now>
to restart it immediately. You may need to enter your administrator level password. Instead of now , you can also type +n , with n representing a number in minutes that will pass before the command is executed. For example, sudo shutdown -r +5 will reboot the Mac in five minutes.
- If you shut down or restart your Mac from the SSH command line, you can immediately lose your SSH connection. This behavior is expected. You can re-authenticate as soon as the remote computer has rebooted.