Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

If we have a collection of Windows and Linux computers on a LAN, is it possible to shutdown a computer having a specific IP address, using the Linux shell?

Assume that I do not have ssh or telnet running on the PCs. I have the root password for all the computers.

share|improve this question

11 Answers 11

up vote 5 down vote accepted

Just to give you an answer based on your question: "Shutting down a pc based on just the ip address is impossible"

You can make it possible by making their desktops or shells available over the network. RDP(windows) / SSH or VNC (linux) will do.

share|improve this answer

Windows has the shutdown /m \\computername command built in, but for Linux you probably would have to install ssh and use ssh root@computername /sbin/shutdown. Why wouldn't a Linux box have SSH installed, anyway?

share|improve this answer
4  
root SSH access is the last thing I will tell people to do! –  LiraNuna Oct 20 '09 at 9:21
    
service sshd has been stopped for some reason. is there no other way to shutdown the pc. i don't want to login. just have to shut it down. –  Rohit Banga Oct 20 '09 at 9:26
1  
As for the root password: see also "Shutdown without sudo user password in Ubuntu" at superuser.com/questions/92925/… –  Arjan Mar 27 '10 at 14:42

A little more context to your problem would be helpful. In general, the answer is 'no'.

Remotely shutting down any random computer is not usually a good thing to be able to do, so most are set up to protect from that happening. If sshd access is blocked, either by being disabled or firewalled, then that computer is even more protected, as it should be, and having root won't do you any good unless you're standing in front of that computer.

On the other hand, there are some compute centers that use management systems to do just what you're thinking. These are often supported either by a special daemon running on the computer, listening on a different network port than sshd, or by using low-level firmware utilities built into the network card. These scenarios require a little planning and won't help you if you've suddenly got a problem now.

Depending upon the age of the computer and the OS, there may be known attack vectors that might get you root access using cracking software. I don't recommend this route, but it exists.

One last idea - there are remotely operated power strips that could be used. If you know which computer it is and which power strip and which plug it is plugged into, you could simply turn off power to that plug. Again, this requires some preplanning, and you want to make sure someone hasn't plug their ventilator into that outlet.

share|improve this answer
    
cracking software. i want to know more about this. it is just an experiment that i want to do in my controlled lab environment. –  Rohit Banga Oct 31 '09 at 12:24

Use out-of-band cards (if the computers don't already have them).

They're not cheap cards, but you assign an IP address to each card and you can remotely power cycle/connect/kvm anything really.

share|improve this answer

You will have to find out what the router is. Once you find it out type the following in a Command Prompt:

shutdown -s -f -m \\"IP of remote machine" -t xx
share|improve this answer

If you install the SSH service, as mentioned before, you can use the ssh command such as:

ssh root@myhost.domain.com shutdown -hy 0

In order to have this all automated, the key exchange should be done, so your private key is in your default ~/.ssh/identity file, and the public part in the ~/.ssh/authorized_keys file on the remote host.

If you look at SSH, you will see all the options and much more.

share|improve this answer
    
As for the root password: see also "Shutdown without sudo user password in Ubuntu" at superuser.com/questions/92925/… –  Arjan Mar 27 '10 at 14:49
  1. Type shutdown -i in the run window.
  2. Click the "Add" button and type the name of the computer you want to shutdown or its IP address.
  3. You can select what you want the computer to do.
  4. In this mode, it's necessary to add a comment. Do so.
  5. Press OK.
share|improve this answer

It is possible through the command as

shutdown -s -f -m \\"ip of remote machine" -t xx

but for this the system must be in lan... -t xx is seconds which you have to specify.

share|improve this answer
    
Windows-only, right? (Just like @Hirvox answered?) –  Arjan Nov 14 '09 at 16:03
    
does this work on linux –  Rohit Banga Nov 16 '09 at 14:54
    
shutdown works on Unix (including most linuxes), but the options are different than the Windows version. For Unix, there's also telinit 0, init 0, delays via at or cron, etc. But for the original question, you need to login to the host over the network. SSH, rsh/rlogin, telnet, etc. can all do it (with appropriate user permissions), but you need at least one of them available. –  mpez0 Mar 27 '10 at 18:29

Enter the following in a Command Prompt:

shutdown -ip 

Then add the IP address and you have different options to shutdown, restart and so on.

share|improve this answer

There Is a program for linux called winexe that can remotely send a command to remote windows machines, and I think if samba is installed on linux, it could work with that too, best thing is, it doesn't need any changes to the windows pcs

share|improve this answer
1  
Welcome to superuser. In order for your answer to be relevant, please include a link to the program you're describing, and perhaps be slightly more definitive about how it works, what its features are, etc. –  MattDMo Jun 21 '13 at 17:27

Only way to shutdown a computer with known IP address without SSH or Telnet access is to login to the system locally and shutdown (Or you can simply press Shutdown button ;) ). However on a serious note you known root password then you can download and install netcat , bind to a port number then -e to bin/bash or cmd.exe (based on the OS) ,login and issue shutdown.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.