092017

Remotely Power off Linux from your Mobile Andrew Mallett | Updated September 2017

Remote ShutdownIn Remotely Power on Linux from your Mobile, I demonstrated how to remotely start a Linux system from various devices including a mobile phone, using Wake-on-LAN. This article shows how to turn the system off again, once you've finished with it.

The method uses SSH (Secure Shell) to log into the system and the Unix shutdown command to power down the server. In a nutshell, SSH into the target system and run the following command..

sudo shutdown -p now

I have incorporated this command into a shell script to be run from my SysAdmin Menu.

Note it is necessary to sudo as normal users usually don't have permission to power down a system.

To install SSH under Linux distros, run the following command..

sudo apt-get install openssh-server

Some FreeBSD type Unixes don't come with sudo, so check out Using sudo on FreeBSD.

Remote shutdown via a mobile smartphone

Connectbot SSH Searching for ssh in Google Playstore brings up a number of free Android SSH apps, so there's plenty of choice. Select and install the one you like the look of.

I use Connectbot which is free and easy to use, with quite a few configuration options.

I find the main issue with using a mobile phone for SSH work is making sure the commands are typed correctly from the smallish touch screens. Simply run the shutdown command as shown above, once you've logged in.

Remote shutdown from MS Windows

Similar results can be achieved using a little Windows application called plink (Putty Link) to do the SSH connection. I have set up a couple of batch files to boot and shutdown my Unix server from Windows 7

 

Back