Shut Down Computers on the Network⚓︎
With the Freetz packages wol and callmonitor, it is easy to start a
computer on the network by mobile phone or through the Freetz web
interface. Shutting down a computer behind a FRITZ!Box can be just as
simple. The configuration is not difficult and works for both Linux and
Windows computers.
Requirements⚓︎
- FRITZ!Box with the packages
dropbear, including the SSH client, and
callmonitor
Configure the FRITZ!Box⚓︎
Generate Keys⚓︎
-
Log in to the FRITZ!Box, create a directory, and generate keys:
-
Extract the public key:
Configure the FRITZ!Box for a Linux Computer to Shut Down⚓︎
- On the FRITZ!Box, create a file such as
/var/tmp/flash/ssh/shutdown_linux_computer.shwith the following
content. Some distributions prevent userrootfrom logging in by
default. Change that setting, or preferably replacerootwith a user
that, for security reasons, only has permission to shut down the
computer.
- As the final configuration step on the FRITZ!Box, add this line to the
Callmonitor listeners:
in:request ^<outgoing_number> ^<incoming_number> HOME=/mod/root && /var/tmp/flash/ssh/shutdown_linux_computer.sh
Configure the FRITZ!Box for a Windows Computer to Shut Down⚓︎
-
On the FRITZ!Box, create a file such as
/var/tmp/flash/ssh/shutdown_windows_computer.shwith the following
content. Replace<username>with the Windows user name:
-
Add this line to the Callmonitor listeners:
Configure the Linux Computer to Shut Down⚓︎
-
Copy the public key, the one extracted earlier, from the FRITZ!Box to
the target computer and authorize it. Replacerootwith
/home/<username>if necessary, and make sure that this user is
allowed to shut down the computer:
-
Install and start the OpenSSH server.
Configure the Windows Computer to Shut Down (Tested on Windows XP)⚓︎
-
Copy the public key from the FRITZ!Box to the target computer, rename
it toauthorized_keys, and place it in
c:\\Documents and Settings\\username\\.ssh\\. On the
author's computer, the folder had to be created in the terminal with
mkdir .sshbecause of the leading dot. -
Install OpenSSH.
-
Adjust the configuration file
c:\\Program Files\\OpenSSH\\etc\\sshd_config.
Correct these values:
The computer can now be shut down by calling the phone number configured
in the Callmonitor listener. It also works through the Freetz web
interface under Extras, Test call.
Notes⚓︎
-
The computer to be shut down must be listed in
/mod/root/.ssh/known_hosts. The easiest way to achieve that is to
connect once from the FRITZ!Box to the computer through SSH. -
To make sure the created files are not lost after a FRITZ!Box reboot,
runmodsave flash.