Mac – restart the Mac remotely via screen sharing if the screen shows only linen

back-to-my-macmacrebootscreen-sharing

I am currently in Norway. My Mac mini is in my apartment in Australia. I can access screen sharing via Back To My Mac. It connects fine, but the screen has only linen – no menu bar, no dock, no anything else. I am fairly sure that is what is actually on the screen and that it isn't a problem with the connection or anything like that (it's happened once before while I was sitting in the same room…)

I know the system is responsive because the one other thing that can poke through my router is the Transmission web interface, and that works just fine. (Unfortunately I seem to have neglected to forward a port for ssh…)

Is there any way I can reboot or otherwise regain full use of the system via the limited screen sharing access that I have?

Best Answer

So apparently you can use the Back To My Mac infrastructure to get to SSH even if there's no port open on the router in front of the relevant Mac:

Find your iCloud account number by executing this command in terminal:

dns-sd -E

Example output

Looking for recommended registration domains:
Timestamp     Recommended Registration domain
23:45:15.660  Added     (More)               local
23:45:15.660  Added                          icloud.com
                                             - > btmm
                                             - - > members
                                             - - - > 123456789

(Make a note of the number on the last line, in this case 123456789 (this is just an example).

The hostname you need to use for ssh is <computer's local hostname>.<number above>.members.btmm.icloud.com. Replace spaces with hyphens, and omit apostrophes (the default name is "Name's <type of Mac>")

The command I used therefore was:

ssh -2 -6 Jons-mac-mini.123456789.members.btmm.icloud.com

To complete the solution to my problem (rebooting), once logged in via SSH, I used the following command to restart:

sudo /sbin/shutdown -r now

(Sourced from here)