Remote Shutdown and Remote Reboot on Linux (Ubuntu) with Just One SSH Command

On Jan 10, 2010 12 comments

Do you need to remotely shutdown or reboot a computer on your network? Do you want to do it with just one ssh command? The answer is here.

Type this command on your terminal :

$ ssh user@remote_computer sudo poweroff

example :

$ ssh john@192.168.1.100 sudo poweroff


That command will make your computer going to shutdown. To reboot you need this command :

$ ssh user@remote_computer sudo reboot

example :

$ ssh john@192.168.1.100 sudo reboot

That command will work nicely. But, you should notice that those two command will prompt you a password twice. To make it not ask you for a password you should copy you ssh key to your remote computer. And make poweroff and reboot command accessible by non root user.

12 comments:

Leo hammarskjöld said...

how do you find the names and ip of other on your network?

Rotua said...

Isn't there any GUI to do this?

Despenteado said...

nmap -sP 192.168.1.1-254 or other subnet

Unknown said...

it was not work for my system
it displays a message like:

sudo: sorry, you must have a tty to run sudo

what can i do

Brian H Wilson said...

You might all see this as OBVIOUS but... If you do the "poweroff" command first then the "reboot" you will be disappointed! Since the power is OFF after the first command the reboot will not happen! ANYWAY

At the risk of compromising your security, if you put your personal key into the root authorized_keys file on the server then you can send commands to it as root without the sudo. The command would simply be "ssh root@remoteserver reboot" and there won't be any password prompts. Kaboom! Use at your own risk. YMMV.

Unknown said...

How To Remotely Shutdown A Computer
http://adf.ly/bRiK3

Devender said...

when I going turnoff in lan numbers of computers in ssh service

when i enter the command in terminal# ssh kmit@10.11.33.143 sudo poweroff
> the error is like this "sudo: no tty present and no askpass program specified


and i need one more help how to connect 100 computers in at time in ssh service then need push softwares all computers

rose said...

Existing without the answers to the difficulties you’ve sorted out through this guide is a critical case, as well as the kind which could have badly affected my entire career if I had not discovered your website.

AWS Training in Bangalore|

rohit said...

nice post thanks for sharing
appvn

Unknown said...

our enthusiasm leads you beyond the limits. When you feel yourself enthusiastic that’s the time you can cross any limit. You seek to get perfection by using the ability of work. Read such motivational article and definitely it will help you to know new facts.
คลื่น Elliott Wave

martin velly said...

It is really helpful article please read it too my blog OUTLOOK KEEPS CRASHING PROBLEM.

varsha said...


Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.

aws training in chennai | aws training in annanagar | aws training in omr | aws training in porur | aws training in tambaram | aws training in velachery

Post a Comment