Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Shut down your Mac remotely System
If, for some reason (can someone think of one?) you'd like to shut down your Mac from another machine, here's how you do it.
  1. Connect to your Mac remotely via SSH or telnet.
  2. Become root ('su' and enter your root password)
  3. Type sync to clear the buffer (may not be necessary with the next command, but I'm cautious!)
  4. Type halt to shut down the machine.
This will (obviously) end your telnet/SSH connection shortly after you type it ;-).

I just tried this from my PC to my Mac, and it did exactly what it was supposed to do ... my Mac shut down cleanly. No errors of any sort on restart, but I did lose my '3 day, 4:54' uptime! I'm not quite sure why one would want to do this, but it is possible.
  • Currently 2.57 / 5
  You rated: 2 / 5 (7 votes cast)

Shut down your Mac remotely | 7 comments | Create New Account
Click here to return to the 'Shut down your Mac remotely' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
`shutdown` is more useful
Authored by: Anonymous on Apr 04, '01 09:34:12AM
if a reboot is necessary [yes, it does happen], the more versatile 'shutdown' command is actually the ability to reboot or shut down remotely can be useful to a sysadmin. But the shutdown command is even cooler you can use it to shut the machine down, reboot, and you can add a handy delay, which will warn all users logged into a terminal that the system is going down. [anyone know if this is tied into Aqua in any way?] to shutdown immediately:
`shutdown now`
to restart at 5:00 PM tomorrow:
`shutdown -r 0104051700`
to restart now:
`shutdown -r now`
to kick all users off, but not shutdown:
`shutdown -k now`
the format for that date is YYMMDDHHMM, by the way. -perry

[ Reply to This | # ]
telnet + root (su) = bad
Authored by: Anonymous on Apr 04, '01 12:23:55PM
Most people are probably aware of this but I feel compelled to make this known, I would hate it to happen to a good mac user... Telnet is a great thing with a major drawback, it sends all information in clear text. This includes your password and possibly your root password. Now, anyone who happens to be sniffing around has your password(s) and knows you have telnet turned on. You have just given up your machine to be an insturment of global destruction (well, maybe not that serve...). If you want to telnet in to your machine do so using SSH. Unfortunatly Apple decided not to include it in the 10.0 relesae of X. StepWise has a write up on how to instal OpenSSH. It worked flawlessly for me. Or, for the lazy, the 10.1 (10.0.1?) release is supposed to have SSH included. Better to be safe, then spend a day reformating and reinstalling...


[ Reply to This | # ]
Shutting down while NOT at console is NOT good.
Authored by: Anonymous on Apr 04, '01 01:18:20PM

This is not a feature, its a BUG.

You're ONLY supposed to be able to shut down if you are on a console directly connected to the machine.

Otherwise, anyone could do a "denial of service" attack by the simple expedient of shutting down your server.

You could be sitting there typing away when somebody telnets into your box and shuts it down on you!

[ Reply to This | # ]
Shutting down while NOT at console is NOT good.
Authored by: Anonymous on Apr 04, '01 06:09:06PM
No this is a feature. Any old user cannot do this. Only root and those with the proper permissions can access this is not available to everyone.

From the 'man' page

Shutdown provides an automated shutdown procedure for super-users to nicely notify users when the system is shutting down, saving them from system administrators, hackers, and gurus, who would otherwise not bother with such niceties.

Available friendlinesses:

-f Shutdown arranges, in the manner of fastboot(8), for the file sys-
tems not to be checked on reboot.

-h The system is halted at the specified time when shutdown execs

-k Kick every body off. The -k option does not actually halt the sys-
tem, but leaves the system multi-user with logins disabled (for all
but super-user).

-n Prevent the normal sync(2) before stopping.

-r Shutdown execs reboot(8) at the specified time.

time Time is the time at which shutdown will bring the system down and
may be the word now (indicating an immediate shutdown) or specify a
future time in one of two formats: +number, or yymmddhhmm, where
the year, month, and day may be defaulted to the current system
values. The first form brings the system down in number minutes
and the second at the absolute time specified.

Any other arguments comprise the warning message that is broadcast
to users currently logged into the system.

- If `-' is supplied as an option, the warning message is read from
the standard input.

At intervals, becoming more frequent as apocalypse approaches and starting at ten hours before shutdown, warning messages are displayed on the
terminals of all users logged in. Five minutes before shutdown, or imme-
diately if shutdown is in less than 5 minutes, logins are disabled by
creating /etc/nologin and copying the warning message there. If this
file exists when a user attempts to log in, login(1) prints its contents
and exits. The file is removed just before shutdown exits.

At shutdown time a message is written in the system log, containing the
time of shutdown, who initiated the shutdown and the reason. A terminate
signal is then sent to init to bring the system down to single-user state
(depending on above options). The time of the shutdown and the warning
message are placed in /etc/nologin and should be used to inform the users
about when the system will be back up and why it is going down (or any-
thing else).

/etc/nologin tells login not to let anyone log in
/fastboot tells rc(8) not to run fsck when rebooting

login(1), wall(1), fastboot(8), halt(8), reboot(8)

The hours and minutes in the second time format may be separated by a
colon (``:'') for backward compatibility.

The shutdown command appeared in 4.0BSD.

4th Berkeley Distribution June 5, 1993

[ Reply to This | # ]
Why you want remote control
Authored by: Anonymous on Apr 04, '01 09:09:22PM

How many times have I gone home before the wonderful support at our university decided to let me know that we will have a 6 hour power outage. My UPS's don't last that long. Shut down the machines (NeXT's or Next for Intel, now OS X) and sleep well.

[ Reply to This | # ]
little misspelling
Authored by: gralem on Apr 05, '01 02:54:44PM

FYI, the command you want for writing all buffers to disk is "sync", not "synch".

[ Reply to This | # ]
Shut down your Mac remotely
Authored by: dweld on May 05, '03 06:13:26PM

another reason you might want to do a remote shutdown-- the
display on my "Yikes" G4 just failed, and I'm using a keyboard
that doesn't have a shutdown key. I want to turn off the
machine, but can't see to navigate the apple menu, and there is
no shutdown key combination. The power button only turns it
on, not off. Last time the plug was pulled on this computer
(accidentally), it destroyed the hard drive (and left scorch
marks!). What to do? Remote shutdown to the rescue!


[ Reply to This | # ]