On Wed, 11 Sep 2002, David Suna wrote:

>
> Alternatively, is there a way to send a command from a Windows
> machine to the Linux box to shut down?I have software on the
> Windows machine that will automatically shutdown the machine
> and will execute a command file before shutting down.If I can set
> up a batch file to send a rsh or ssh instruction to shutdown then I
> can accomplish the automatic shutdown based on the UPS on the
> Windows box.Not as exact but better than what I have now.

Sure:

1. make sure your linux box sshd allows root logins (BTW: what about the
user "shutdown"?)

2. create a public/private key pair. Keep the private key in a safe place
on the windows machine

3. Add the following to /root/.ssh/authorized_keys (this will probably be
the only line there:

from="windows_machine",command="/sbin/halt" <contents of the public key>

Result: any ssh client connecting as root@your_linux_box and
authenticating with the private key of that public key will cause
execution of /sbin/halt .

Disclaimer: The above is *untested*.


See sshd(8) for more information on the format of authorized_keys. Also
refer to the docs of your ssh client. sshd is quite sensetive to things
like the permissions on the authorized_keys file and the path to there.

-- 
Tzafrir Cohen
mailto:[EMAIL PROTECTED]
http://www.technion.ac.il/~tzafrir



=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

  • UPS... David Suna
    • ... Tzafrir Cohen
    • ... Yaacov Fenster - System Engineering Troubleshooting and other miracles
    • ... Oleg Kobets
    • ... Oleg Kobets

Reply via email to