[K12OSN] OT: Shutdown Linux from Windows?

Jon Spriggs jon at spriggs.org.uk
Wed Sep 6 08:07:26 UTC 2006


Kevin,

The way to do it is

1) Create a public/private key pair using puttygen (or ssh-keygen I think).
2) Transfer the public key to the server in the /root/.ssh/authorized_keys file
3) On your windows machine, use plink (or ssh) using the following syntax
  plink -i c:\path\to\private.key root at myserver init 0
4) Your server should shut down. Instead of init 0, you can use init 6
to reboot it.

I would strongly recommend that you use a passphrase on your key pair
to ensure that the servers are not compromised. If you don't use a
passphrase (as you wouldn't be able to for completely automated
scripting), I would recommend using one server as a chaining shutdown
server (in that, you connect to one server, launch the shutdown script
and it shuts down all your servers).

Regards,

Jon

On 06/09/06, Onatawahtaw <onatawahtaw at yahoo.ca> wrote:
> Thanks Doug and others!
>
> While this is a very unique idea (one that I will
> definately keep for future reference) it also requires
> that I have a dedicated windows computer that needs to
> be on all the time. I do not have a dedicated windows
> computer. Though, even if I did if it were to ever
> crash (ok not very likely with a MS system) ;) that
> would mean all the students would lose what they are
> working on as theirs will shut down.
>
> Perhaps sending a shutdown command through ssh would
> be ideal. Though I'd have to figure out how to script
> it.
>
> Cool idea though Doug. I like it!
>
> God bless,
>
> -Kevin
>
> --- Doug Simpson <veewee77 at alltel.net> wrote:
>
> > Here is a possibility. . .
> >
> > Ping the winders box (the one from which you want to
> > shut down the linux
> > server) and outputs to a file.
> >
> > example:
> > [server]$ ping -i 5 servername >> /pingreturns
> > This pings the server every 5 seconds. Change the
> > number to whatever
> > resolution you want.
> > Run this fron a cron job at a time a bit after you
> > expect the winders
> > computer to be online, say half an hour after. (or
> > you could put it in
> > the rc.local so it will run when the server is
> > started, just make sure
> > the winders one is up enough to reply to ping
> > requests or the linux will
> > go back down again.)
> > Run a second cron job that runs every minute (or
> > whatever resolution you
> > prefer) that
> > greps this outut file for a string stating that the
> > pinged hosts is
> > unreachable:
> >
> > grep reply /pingreturns and if it finds "reply from"
> > then exit.
> >
> > If it finds "unreachable" branch and delete the
> > /pingreturns file
> > and then run "shutdown -h now".
> >
> > The grep line is the one I will need help with the
> > syntax and it may
> > actually have to be done in a script that would run
> > in the cron job.
> >
> > What this will do is ping the winders computer. If
> > it returns, all is
> > well. If it is unreachable, delete the /pingreturn
> > file (so it won't try
> > to use it tomorrow and find "unreachable" in there
> > and shut right back
> > down again) and then shutdown the linux computer
> > with:
> > shutdown -h now
> > in the script.
> >
> > Assuming this is a daily thing, you will only need
> > to shutdown the
> > winders one and the linux will soon follow it based
> > on your resolution
> > as mentioned above.
> >
> > I will try to play with the grep thing later and see
> > if I can come up
> > with a workable solution for you.
> >
> > Hope this is what you were looking for.
> >
> > Doug
> >
> >
> >
> >
> >
> > Onatawahtaw wrote:
> >
> > >Greetings,
> > >
> > >Currently I can shut down all my windows computers
> > >using psshutdown.exe (and a batch program). Is
> > there
> > >any way I can shut down linux computers from within
> > >windows?
> > >
> > >If not, how can I shutdown remote linux computers
> > from
> > >within linux? All the linux computers use the same
> > >root password so I would like to just put them in a
> > >shell script.
> > >
> > >Thanks,
> > >
> > >-Kevin
> > >
> > >__________________________________________________
> > >Do You Yahoo!?
> > >Tired of spam?  Yahoo! Mail has the best spam
> > protection around
> > >http://mail.yahoo.com
> > >
> > >_______________________________________________
> > >K12OSN mailing list
> > >K12OSN at redhat.com
> > >https://www.redhat.com/mailman/listinfo/k12osn
> > >For more info see <http://www.k12os.org>
> > >
> > >
> > >
> >
> > _______________________________________________
> > K12OSN mailing list
> > K12OSN at redhat.com
> > https://www.redhat.com/mailman/listinfo/k12osn
> > For more info see <http://www.k12os.org>
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> _______________________________________________
> K12OSN mailing list
> K12OSN at redhat.com
> https://www.redhat.com/mailman/listinfo/k12osn
> For more info see <http://www.k12os.org>
>




More information about the K12OSN mailing list