OpenSSH + remotely shutting windows from Linux - SSH

This is a discussion on OpenSSH + remotely shutting windows from Linux - SSH ; I have to remotely shut the windows px from linux box. I run OpenSSH on windows PC. I remotely connect it from Linux box using ..... ssh Admin@IP_ADDR # connects me fine now without problems (LOCAL) Next, I wrote a ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: OpenSSH + remotely shutting windows from Linux

  1. OpenSSH + remotely shutting windows from Linux

    I have to remotely shut the windows px from linux box.

    I run OpenSSH on windows PC. I remotely connect it from Linux box using
    .....

    ssh Admin@IP_ADDR # connects me fine now without problems
    (LOCAL)

    Next, I wrote a script that would log me in and also shut the windows
    pc down, so I wrote a script

    ssh Admin@IP_ADDR # connects me fine now without problems (LOCAL)
    shutdown -s # This is a windows command (REMOTE)

    Now, when I run this script, it successfully logs me into the windows
    box but doesn't run the second part of the script which is to shut down
    the windows PC.

    Can you please tell me why ??

    Every help is appreciated.


  2. Re: OpenSSH + remotely shutting windows from Linux

    I found the right way which is to have them in one line to execute
    remotely.


    ssh username@IP_ADDR shutdown -s


    Hope this help others sometimes.


  3. Re: OpenSSH + remotely shutting windows from Linux

    diffuser78@gmail.com writes:

    >I have to remotely shut the windows px from linux box.


    >I run OpenSSH on windows PC. I remotely connect it from Linux box using
    >....


    >ssh Admin@IP_ADDR # connects me fine now without problems
    >(LOCAL)


    >Next, I wrote a script that would log me in and also shut the windows
    >pc down, so I wrote a script


    >ssh Admin@IP_ADDR # connects me fine now without problems (LOCAL)
    >shutdown -s # This is a windows command (REMOTE)


    This says "run the ssh command. When the ssh command finally exits, run the
    shutdown -s command (on the local machine). Not what you want.

    man ssh
    ssh Admin@IP_ADDR "shutdown -s"
    should do what you want.




    >Now, when I run this script, it successfully logs me into the windows
    >box but doesn't run the second part of the script which is to shut down
    >the windows PC.


    >Can you please tell me why ??


    man ssh


    >Every help is appreciated.



+ Reply to Thread