remote command with putty - SSH

This is a discussion on remote command with putty - SSH ; Hi, I try to find a way to execute a remote command with putty on the command line. Unfortunately I can NOT use plink, it has to be putty. In addition I can NOT use stored sessions, I have to ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: remote command with putty

  1. remote command with putty

    Hi,

    I try to find a way to execute a remote command with putty on the
    command line. Unfortunately I can NOT use plink, it has to be putty.
    In addition I can NOT use stored sessions, I have to give all
    parameters via the command line.

    First I tried to give the remote command directly in the command line
    as if putty was plink:

    > putty.exe user@192.168.1.1 "ls -la"


    Did not work. Error message = Invalid Port Number. As I did not find
    any related hint in the putty docs, I suppose putty does not accept
    remote commands in the command line. But I found the option -m which
    allows to specify a file containing one (or more) remote commands:

    > putty.exe -m remoteCommand.sh user@192.168.1.1


    where remoteComand.sh conntains only one command: ls -la

    Does not work. After prompting me for the user-password the putty
    shell closes immediately, without running the remote command. I found
    the same error report a few times in the web, but the solution always
    was using plink ...

    Any ideas?


  2. Re: remote command with putty

    Alex writes:

    >Hi,


    >I try to find a way to execute a remote command with putty on the
    >command line. Unfortunately I can NOT use plink, it has to be putty.
    >In addition I can NOT use stored sessions, I have to give all
    >parameters via the command line.


    >First I tried to give the remote command directly in the command line
    >as if putty was plink:


    >> putty.exe user@192.168.1.1 "ls -la"


    >Did not work. Error message = Invalid Port Number. As I did not find
    >any related hint in the putty docs, I suppose putty does not accept
    >remote commands in the command line. But I found the option -m which
    >allows to specify a file containing one (or more) remote commands:


    >> putty.exe -m remoteCommand.sh user@192.168.1.1


    >where remoteComand.sh conntains only one command: ls -la


    >Does not work. After prompting me for the user-password the putty
    >shell closes immediately, without running the remote command. I found
    >the same error report a few times in the web, but the solution always
    >was using plink ...


    Exactly where did you expect it to put the output to ls -la? How do you
    know it did not run the remote command? So something remotely that at least
    leaves a trace of itself having been run.



    >Any ideas?



  3. Re: remote command with putty

    On Sep 26, 1:27 am, Unruh wrote:
    > Alex writes:
    > >Hi,
    > >I try to find a way to execute a remote command with putty on the
    > >command line. Unfortunately I can NOT use plink, it has to be putty.
    > >In addition I can NOT use stored sessions, I have to give all
    > >parameters via the command line.
    > >First I tried to give the remote command directly in the command line
    > >as if putty was plink:
    > >> putty.exe u...@192.168.1.1 "ls -la"

    > >Did not work. Error message = Invalid Port Number. As I did not find
    > >any related hint in the putty docs, I suppose putty does not accept
    > >remote commands in the command line. But I found the option -m which
    > >allows to specify a file containing one (or more) remote commands:
    > >> putty.exe -m remoteCommand.sh u...@192.168.1.1

    > >where remoteComand.sh conntains only one command: ls -la
    > >Does not work. After prompting me for the user-password the putty
    > >shell closes immediately, without running the remote command. I found
    > >the same error report a few times in the web, but the solution always
    > >was using plink ...

    >
    > Exactly where did you expect it to put the output to ls -la? How do you
    > know it did not run the remote command? So something remotely that at least
    > leaves a trace of itself having been run.
    >
    > >Any ideas?


    Well, I expected the output to ls -la appearing in the terminal window
    opened by putty, where I am also challenged for my password. I also
    tested it with other commands, which leave a trace of having been
    executed and / or require more user interaction. Same effect: The
    putty terminal closes immediately after typing in my password. No
    traces on the target machine ...




+ Reply to Thread