SSH scripting and Putty

Post Reply
Mikko
Posts: 5
Joined: Thu Apr 17, 2014 2:12 am

SSH scripting and Putty

Post by Mikko »

Good day,
I am very new to scripting but interested in learning more.
I have to do my 3par scripting with putty via SSH. I created the public/private keys but when I execute putty from command line and give an external file (my script) as an argument it just says "unprintable characters in command". The script works fine if I execute it interactively. Is this a putty- related issue or something else? '
Also, is it possible to execute multiple commands from one external file? What is the best practice using SSH?
Thank you very much for your help!
apol
Posts: 267
Joined: Wed May 07, 2014 1:51 am

Re: SSH scripting and Putty

Post by apol »

Hi,

when you use kitty (beefed up putty) instead of plain putty, there is a "send script file" option in the menu. But this way isn't that good for real scripting, it just dumps the whole file as is. This can be a problem with commands that start a task (which you have to wait for before going on), or if you put some logic in your scripts. Error handling, loops, etc.

I prefer the ssh-cli for interactive working, but use a local installed cli for scripting.

But to be honest, I'm not a very savvy user of putty or kitty, so there might of course be a way to do better than I do :?
When all else fails, read the instructions.
User avatar
Richard Siemers
Site Admin
Posts: 1333
Joined: Tue Aug 18, 2009 10:35 pm
Location: Dallas, Texas

Re: SSH scripting and Putty

Post by Richard Siemers »

Putty is intended to be an interactive GUI.
plink (part of putty) is the command line version.

Try plink with your -m script.
Richard Siemers
The views and opinions expressed are my own and do not necessarily reflect those of my employer.
hdtvguy
Posts: 576
Joined: Sun Jul 29, 2012 9:30 am

Re: SSH scripting and Putty

Post by hdtvguy »

Any reason why you have to do it via SSH and not via the CLI? The CLI is extremely powerful and has numerous features to make life easy for scripting.
Post Reply