The title can't be more specific. I'd like you to suggest the best way to send the poweroff instruction, to windows or Linux.
- WOL enabled BIOS: In order to power up the remote host, you first have to enable WOL in his bios. The way you have to do this will vary from motherboard to motherboard, sou you'll have to figure it out by your self, or ask Google for some help.
- Remote Host cable connected to router
- Application capable of Sending Magic Packets to Remote.host's MacAdress
At the moment I'm using WOLdroid WOL Wake On Lan On remote.host execute:
Detect your remote.host's ehternet board usualy eth0 and save the HW Adress value XX:XX:XX:XX:XX:XX:XX
Enter that number when WOLdroid asks you for a mac adress. And your done.
Now you're able to powerup remotely
1. Prepare the Remote Host:
Remote host with Ubuntu 12.04
Create your private and public key files
To follow these steps you'll have to access your remote host, physically, or using another computer. I'll describe this as if you have physical access to the remote.host
Open a command window and install the ssh protocol:
sudo apt-get install ssh
Create public and private keys using ssh-key-gen
You should save the generated key in:
Press enter twice to leave the passphrase empty.
Your identification has been saved in /home/yourusername/.ssh/id_rsa. Your public key has been saved in /home/yourusername/.ssh/id_rsa.pub. The key fingerprint is: XX:XX:XX:xX:XX:xX:XX:XX:XX:XX:XX:XX:XX:XX yourusername@remote-host
Now copy the id_rsa.pub to your ~/.ssh/authorized_keys file with this command:
ssh-copy-id -i ~/.ssh/id_rsa.pub remote.host
Now you have to be able to execute the sudo shutdown -P 0 with no password.
Modify /etc/sudoers on remote.host with visudo
That way user "yourusername" can execute the shutdown command with no password asked.
By running visudo, it leads to edit /etc/sudoers.
Add the line below to that file.
yourusername ALL = NOPASSWD: /sbin/shutdown
Now we are able to access remotely, and shutdown without passwords asked.
2. Prepare your Android
- Connect your android to the remote host and with your file explorer copy the id_rsa file located in ~/.ssh/ folder to the Android's SD card.
- Disconnect your android from the remote host
- Install a ssh client program. (ex. ConnectBot)
- Open Connect Bot and go to Manage Pubkeys > Import and select the key you copied later.
- Go back to Connect Bot's Main Scren and select the ssh protocol from the list and enter
email@example.com. Notice that it creates a line in the main screen with the data you input.
- Push it for a couple of seconds and select edit host.
Use pubkey authenticationand select
sudo shutdown -P 0
- Go back to you the Main Screen of Connect Bot and we're done!
Now you can Turn on and Shutdown a remote.host :)
You can simply enable Wake-on-LAN on your computer through BIOS setup, then use any of the several WOL apps to send the power-on command over the network. Some apps like SyncMe also include WOL functionality, so a separate WOL app may not be needed.
Shutdown on Windows
In general it will involve some server utility installed on the computer, and the client-side Android app communicating with it, for example oneID. These apps usually include other features, which may be overkill. You could use SSH and call the
shutdown.exe utility, but it may be overkill too. Besides, these solutions may not shut down Windows "properly". For example, neither oneID nor
shutdown.exe were able to trigger my "backup on logoff" routine.
For these reasons I end up writing my own small solution. WebShutdown is a small web server which is going to shut down the computer when a specific HTTP GET request is received. That means you can turn off your computer from Android device by simply tapping a Tasker or web shortcut on home screen. Windows is going to shut down "properly", meaning your logoff scripts configured in Group Policy will get executed normally.
You can run the server on computer startup like this for example:
webshutdown.exe 80 valid_password.txt. Then, on Android device you access the web address
http://COMPUTER/shutdown?auth=<password> to start system shutdown.
If your network card can use Wake-On-LAN and/or is supported, and is remotely accessible, then yes, it is quite possible to achieve it (wake-on-lan apps are in abundance on the play store), taking into account of security considerations which is outside of the scope of this site, double check and make sure no other service is on that public facing PC otherwise bad guys will get in and wreak havoc.