See Using the command-line connection tool Plink.Īnd with Plink, you can actually provide the command directly on its command-line: plink.exe -ssh -pw password command > output. Now to automate this via a script we will create a ssh agent and bind it to the private key which we use while connecting to the remote server rootserver eval ssh-agent ssh-add /root/.ssh/idrsa Agent pid 60251 Enter passphrase for /root/.ssh/idrsa: Identity added: /root/.ssh/idrsa (). It's a console application, so you can redirect its output to a file (what you cannot do with PuTTY).Ī command-line syntax is identical, an output redirection added: plink.exe -ssh -pw password -m c:\path\command.txt > output.txt Though note that you should use Plink (a command-line connection tool from PuTTY suite). c:\path\command.txt) and pass that to PuTTY: putty.exe -ssh -pw password -m c:\path\command.txt Version 21. So you have to save your command ( command_run) to a plain text file (e.g. The -m switch of PuTTY takes a path to a script file as an argument, not a command. For example login into remote system called and find out who logged in, enter: ssh who You can use same command in shell script.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |