Run remote command with puttyPutty SSH connection not workingHow to recover from “Too many Authentication...

Why do passenger jet manufacturers design their planes with stall prevention systems?

"of which" is correct here?

Is it possible to upcast ritual spells?

Do I need to be arrogant to get ahead?

What options are left, if Britain cannot decide?

How do you talk to someone whose loved one is dying?

Are ETF trackers fundamentally better than individual stocks?

What is the significance behind "40 days" that often appears in the Bible?

What is "focus distance lower/upper" and how is it different from depth of field?

How to write cleanly even if my character uses expletive language?

How do I change two letters closest to a string and one letter immediately after a string using Notepad++?

Converting a variable frequency to TTL HIGH and LOW levels, based on a fixed (possible non-fixed?) frequency

Are Roman Catholic priests ever addressed as pastor

How do I hide Chekhov's Gun?

The German vowel “a” changes to the English “i”

Why does overlay work only on the first tcolorbox?

Are relativity and doppler effect related?

What is a ^ b and (a & b) << 1?

Math equation in non italic font

How to make healing in an exploration game interesting

Is a party consisting of only a bard, a cleric, and a warlock functional long-term?

What exactly is this small puffer fish doing and how did it manage to accomplish such a feat?

How to explain that I do not want to visit a country due to personal safety concern?

Employee lack of ownership



Run remote command with putty


Putty SSH connection not workingHow to recover from “Too many Authentication Failures for user root”PuTTY Session Closed on Expired Password Over SSH ConnectionUsing ctrl-arrow keys with PuTTY and screenPuTTY Option: Remote command = 'Top' / How to retain session after 'q' command?Setup Linux for PuttyHow to fix PuTTY showing garbled characters?problems with putty while establishing ssh connection (Ubuntu Server)Output of remote cmds in putty is always truncated after 80 charsConverting SSH command to a PuTTY command













2















When I do putty -ssh user@host -pw password echo "hi"



I get a network error



But if I do putty -ssh user@host -pw password



An SSH session is successfully opened in a putty terminal. But I just want to run a single command. How do I do this in Putty?










share|improve this question




















  • 1





    You are trying to do things which are easier to accomplish on non-Windows operating systems. Consider whether you can use something other than Windows as your workstation OS.

    – Michael Hampton
    Dec 7 '16 at 8:56











  • Why do you want to use putty like this? It is much easier to use the terminal (both in linux and osx) to do this

    – Orphans
    Dec 7 '16 at 14:54






  • 1





    @MichaelHampton It's for an automated script that would be running on developer's window machines.

    – Mr. Me
    Dec 7 '16 at 16:18
















2















When I do putty -ssh user@host -pw password echo "hi"



I get a network error



But if I do putty -ssh user@host -pw password



An SSH session is successfully opened in a putty terminal. But I just want to run a single command. How do I do this in Putty?










share|improve this question




















  • 1





    You are trying to do things which are easier to accomplish on non-Windows operating systems. Consider whether you can use something other than Windows as your workstation OS.

    – Michael Hampton
    Dec 7 '16 at 8:56











  • Why do you want to use putty like this? It is much easier to use the terminal (both in linux and osx) to do this

    – Orphans
    Dec 7 '16 at 14:54






  • 1





    @MichaelHampton It's for an automated script that would be running on developer's window machines.

    – Mr. Me
    Dec 7 '16 at 16:18














2












2








2








When I do putty -ssh user@host -pw password echo "hi"



I get a network error



But if I do putty -ssh user@host -pw password



An SSH session is successfully opened in a putty terminal. But I just want to run a single command. How do I do this in Putty?










share|improve this question
















When I do putty -ssh user@host -pw password echo "hi"



I get a network error



But if I do putty -ssh user@host -pw password



An SSH session is successfully opened in a putty terminal. But I just want to run a single command. How do I do this in Putty?







putty






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 7 '16 at 8:43









030

3,79464087




3,79464087










asked Dec 6 '16 at 23:41









Mr. MeMr. Me

113115




113115








  • 1





    You are trying to do things which are easier to accomplish on non-Windows operating systems. Consider whether you can use something other than Windows as your workstation OS.

    – Michael Hampton
    Dec 7 '16 at 8:56











  • Why do you want to use putty like this? It is much easier to use the terminal (both in linux and osx) to do this

    – Orphans
    Dec 7 '16 at 14:54






  • 1





    @MichaelHampton It's for an automated script that would be running on developer's window machines.

    – Mr. Me
    Dec 7 '16 at 16:18














  • 1





    You are trying to do things which are easier to accomplish on non-Windows operating systems. Consider whether you can use something other than Windows as your workstation OS.

    – Michael Hampton
    Dec 7 '16 at 8:56











  • Why do you want to use putty like this? It is much easier to use the terminal (both in linux and osx) to do this

    – Orphans
    Dec 7 '16 at 14:54






  • 1





    @MichaelHampton It's for an automated script that would be running on developer's window machines.

    – Mr. Me
    Dec 7 '16 at 16:18








1




1





You are trying to do things which are easier to accomplish on non-Windows operating systems. Consider whether you can use something other than Windows as your workstation OS.

– Michael Hampton
Dec 7 '16 at 8:56





You are trying to do things which are easier to accomplish on non-Windows operating systems. Consider whether you can use something other than Windows as your workstation OS.

– Michael Hampton
Dec 7 '16 at 8:56













Why do you want to use putty like this? It is much easier to use the terminal (both in linux and osx) to do this

– Orphans
Dec 7 '16 at 14:54





Why do you want to use putty like this? It is much easier to use the terminal (both in linux and osx) to do this

– Orphans
Dec 7 '16 at 14:54




1




1





@MichaelHampton It's for an automated script that would be running on developer's window machines.

– Mr. Me
Dec 7 '16 at 16:18





@MichaelHampton It's for an automated script that would be running on developer's window machines.

– Mr. Me
Dec 7 '16 at 16:18










3 Answers
3






active

oldest

votes


















5














You might want to use plink (which is shipped with putty) instead of putty for this.



Quote from the documentation:




Plink is a command-line connection tool similar to UNIX `ssh'. It is
mostly used for automated operations, such as making CVS access a
repository on a remote server.




For your example:



plink -ssh user@host -pw password echo "hi"





share|improve this answer































    1














    Per the putty manual, there is only -m which can be used to give it a file containing one or more commands to be executed in sequence.






    share|improve this answer


























    • -m does not execute a script. It reads a list of commands to execute remotely from a local file. This might be equivalent with simple scripts that only execute command after command, but when you add loops or operations on the output of commands this will stop working. Quote from the documention: With some servers [...] you can even put multiple lines in this file and execute more than one command in sequence, or a whole shell script; but this is arguably an abuse, and cannot be expected to work on all servers.

      – Gerald Schneider
      Dec 7 '16 at 9:12













    • @GeraldSchneider script: computing: an automated series of instructions carried out in a specific order. But yes... it's probably clearer to say multiple commands in sequence

      – ETL
      Dec 7 '16 at 14:50





















    0














    As @GeraldSchneider suggests, PLINK is more suitable, but if you really wanted to use PuTTY this is how you could do it:



    First, you need to set a few things up as follows:




    1. Connect to the remote box via PuTTY, as in your example.

    2. While on the remote box, create a script to echo "hi". Name it hello.sh.

    3. Right-click the PuTTY window caption and select 'Change Settings...".

    4. Type the name my-saved-session and click Save then Cancel.

    5. Exit the session. Open the PuTTY Configuration panel again.

    6. Select your saved my-saved-session session and click Load.

    7. On the left of the 'Category' tree view, click 'SSH'.

    8. In the 'Remote command' box type /hello.sh -o.

    9. Click back on 'Session' and click Save.


    Now you're good to run the command:



    putty -ssh user@host -pw password -load my-saved-session





    share























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "2"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f819162%2frun-remote-command-with-putty%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      5














      You might want to use plink (which is shipped with putty) instead of putty for this.



      Quote from the documentation:




      Plink is a command-line connection tool similar to UNIX `ssh'. It is
      mostly used for automated operations, such as making CVS access a
      repository on a remote server.




      For your example:



      plink -ssh user@host -pw password echo "hi"





      share|improve this answer




























        5














        You might want to use plink (which is shipped with putty) instead of putty for this.



        Quote from the documentation:




        Plink is a command-line connection tool similar to UNIX `ssh'. It is
        mostly used for automated operations, such as making CVS access a
        repository on a remote server.




        For your example:



        plink -ssh user@host -pw password echo "hi"





        share|improve this answer


























          5












          5








          5







          You might want to use plink (which is shipped with putty) instead of putty for this.



          Quote from the documentation:




          Plink is a command-line connection tool similar to UNIX `ssh'. It is
          mostly used for automated operations, such as making CVS access a
          repository on a remote server.




          For your example:



          plink -ssh user@host -pw password echo "hi"





          share|improve this answer













          You might want to use plink (which is shipped with putty) instead of putty for this.



          Quote from the documentation:




          Plink is a command-line connection tool similar to UNIX `ssh'. It is
          mostly used for automated operations, such as making CVS access a
          repository on a remote server.




          For your example:



          plink -ssh user@host -pw password echo "hi"






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 7 '16 at 8:48









          Gerald SchneiderGerald Schneider

          6,49512446




          6,49512446

























              1














              Per the putty manual, there is only -m which can be used to give it a file containing one or more commands to be executed in sequence.






              share|improve this answer


























              • -m does not execute a script. It reads a list of commands to execute remotely from a local file. This might be equivalent with simple scripts that only execute command after command, but when you add loops or operations on the output of commands this will stop working. Quote from the documention: With some servers [...] you can even put multiple lines in this file and execute more than one command in sequence, or a whole shell script; but this is arguably an abuse, and cannot be expected to work on all servers.

                – Gerald Schneider
                Dec 7 '16 at 9:12













              • @GeraldSchneider script: computing: an automated series of instructions carried out in a specific order. But yes... it's probably clearer to say multiple commands in sequence

                – ETL
                Dec 7 '16 at 14:50


















              1














              Per the putty manual, there is only -m which can be used to give it a file containing one or more commands to be executed in sequence.






              share|improve this answer


























              • -m does not execute a script. It reads a list of commands to execute remotely from a local file. This might be equivalent with simple scripts that only execute command after command, but when you add loops or operations on the output of commands this will stop working. Quote from the documention: With some servers [...] you can even put multiple lines in this file and execute more than one command in sequence, or a whole shell script; but this is arguably an abuse, and cannot be expected to work on all servers.

                – Gerald Schneider
                Dec 7 '16 at 9:12













              • @GeraldSchneider script: computing: an automated series of instructions carried out in a specific order. But yes... it's probably clearer to say multiple commands in sequence

                – ETL
                Dec 7 '16 at 14:50
















              1












              1








              1







              Per the putty manual, there is only -m which can be used to give it a file containing one or more commands to be executed in sequence.






              share|improve this answer















              Per the putty manual, there is only -m which can be used to give it a file containing one or more commands to be executed in sequence.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Dec 7 '16 at 14:51

























              answered Dec 7 '16 at 0:08









              ETLETL

              5,50711944




              5,50711944













              • -m does not execute a script. It reads a list of commands to execute remotely from a local file. This might be equivalent with simple scripts that only execute command after command, but when you add loops or operations on the output of commands this will stop working. Quote from the documention: With some servers [...] you can even put multiple lines in this file and execute more than one command in sequence, or a whole shell script; but this is arguably an abuse, and cannot be expected to work on all servers.

                – Gerald Schneider
                Dec 7 '16 at 9:12













              • @GeraldSchneider script: computing: an automated series of instructions carried out in a specific order. But yes... it's probably clearer to say multiple commands in sequence

                – ETL
                Dec 7 '16 at 14:50





















              • -m does not execute a script. It reads a list of commands to execute remotely from a local file. This might be equivalent with simple scripts that only execute command after command, but when you add loops or operations on the output of commands this will stop working. Quote from the documention: With some servers [...] you can even put multiple lines in this file and execute more than one command in sequence, or a whole shell script; but this is arguably an abuse, and cannot be expected to work on all servers.

                – Gerald Schneider
                Dec 7 '16 at 9:12













              • @GeraldSchneider script: computing: an automated series of instructions carried out in a specific order. But yes... it's probably clearer to say multiple commands in sequence

                – ETL
                Dec 7 '16 at 14:50



















              -m does not execute a script. It reads a list of commands to execute remotely from a local file. This might be equivalent with simple scripts that only execute command after command, but when you add loops or operations on the output of commands this will stop working. Quote from the documention: With some servers [...] you can even put multiple lines in this file and execute more than one command in sequence, or a whole shell script; but this is arguably an abuse, and cannot be expected to work on all servers.

              – Gerald Schneider
              Dec 7 '16 at 9:12







              -m does not execute a script. It reads a list of commands to execute remotely from a local file. This might be equivalent with simple scripts that only execute command after command, but when you add loops or operations on the output of commands this will stop working. Quote from the documention: With some servers [...] you can even put multiple lines in this file and execute more than one command in sequence, or a whole shell script; but this is arguably an abuse, and cannot be expected to work on all servers.

              – Gerald Schneider
              Dec 7 '16 at 9:12















              @GeraldSchneider script: computing: an automated series of instructions carried out in a specific order. But yes... it's probably clearer to say multiple commands in sequence

              – ETL
              Dec 7 '16 at 14:50







              @GeraldSchneider script: computing: an automated series of instructions carried out in a specific order. But yes... it's probably clearer to say multiple commands in sequence

              – ETL
              Dec 7 '16 at 14:50













              0














              As @GeraldSchneider suggests, PLINK is more suitable, but if you really wanted to use PuTTY this is how you could do it:



              First, you need to set a few things up as follows:




              1. Connect to the remote box via PuTTY, as in your example.

              2. While on the remote box, create a script to echo "hi". Name it hello.sh.

              3. Right-click the PuTTY window caption and select 'Change Settings...".

              4. Type the name my-saved-session and click Save then Cancel.

              5. Exit the session. Open the PuTTY Configuration panel again.

              6. Select your saved my-saved-session session and click Load.

              7. On the left of the 'Category' tree view, click 'SSH'.

              8. In the 'Remote command' box type /hello.sh -o.

              9. Click back on 'Session' and click Save.


              Now you're good to run the command:



              putty -ssh user@host -pw password -load my-saved-session





              share




























                0














                As @GeraldSchneider suggests, PLINK is more suitable, but if you really wanted to use PuTTY this is how you could do it:



                First, you need to set a few things up as follows:




                1. Connect to the remote box via PuTTY, as in your example.

                2. While on the remote box, create a script to echo "hi". Name it hello.sh.

                3. Right-click the PuTTY window caption and select 'Change Settings...".

                4. Type the name my-saved-session and click Save then Cancel.

                5. Exit the session. Open the PuTTY Configuration panel again.

                6. Select your saved my-saved-session session and click Load.

                7. On the left of the 'Category' tree view, click 'SSH'.

                8. In the 'Remote command' box type /hello.sh -o.

                9. Click back on 'Session' and click Save.


                Now you're good to run the command:



                putty -ssh user@host -pw password -load my-saved-session





                share


























                  0












                  0








                  0







                  As @GeraldSchneider suggests, PLINK is more suitable, but if you really wanted to use PuTTY this is how you could do it:



                  First, you need to set a few things up as follows:




                  1. Connect to the remote box via PuTTY, as in your example.

                  2. While on the remote box, create a script to echo "hi". Name it hello.sh.

                  3. Right-click the PuTTY window caption and select 'Change Settings...".

                  4. Type the name my-saved-session and click Save then Cancel.

                  5. Exit the session. Open the PuTTY Configuration panel again.

                  6. Select your saved my-saved-session session and click Load.

                  7. On the left of the 'Category' tree view, click 'SSH'.

                  8. In the 'Remote command' box type /hello.sh -o.

                  9. Click back on 'Session' and click Save.


                  Now you're good to run the command:



                  putty -ssh user@host -pw password -load my-saved-session





                  share













                  As @GeraldSchneider suggests, PLINK is more suitable, but if you really wanted to use PuTTY this is how you could do it:



                  First, you need to set a few things up as follows:




                  1. Connect to the remote box via PuTTY, as in your example.

                  2. While on the remote box, create a script to echo "hi". Name it hello.sh.

                  3. Right-click the PuTTY window caption and select 'Change Settings...".

                  4. Type the name my-saved-session and click Save then Cancel.

                  5. Exit the session. Open the PuTTY Configuration panel again.

                  6. Select your saved my-saved-session session and click Load.

                  7. On the left of the 'Category' tree view, click 'SSH'.

                  8. In the 'Remote command' box type /hello.sh -o.

                  9. Click back on 'Session' and click Save.


                  Now you're good to run the command:



                  putty -ssh user@host -pw password -load my-saved-session






                  share











                  share


                  share










                  answered 3 mins ago









                  CorCor

                  62




                  62






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Server Fault!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f819162%2frun-remote-command-with-putty%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      117736 Шеррод Примітки | Див. також | Посилання | Навігаційне...

                      As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

                      Маріан Котлеба Зміст Життєпис | Політичні погляди |...