Method to run a shell script using shortcut key in keyboard with out logging to putty

Dear All,

I want to run a shell script with out logging to putty but configuring it to a keyboard short cut it windows PC. Can this be done? I want this to rename a log in a specified folder in a system

Thanks

You don't "log to putty", you login to a system using putty as a ssh client (or telnet as it has this as well). And, you can't do anything on a system without logging in with adequate authentication info, which in turn might be sth like a single sign-in or domain auth. setup, though.
What you could do is assign a script or a macro to a "hot key" in putty that would do all this for you.

is thi mean that we can't assign a short key to logging to a server?

you have to:

  1. create a profile in Putty
  2. generate SSH key and make password-less authentication using putty
  3. write a bat-file which starts putty with your profile and runs a command on the remote server
  4. assign a key to the batch

Thanks agent.kgb
I will follow this procedure.

I have done logging to the server via a .bat file.
But cannot understand how can I run a specified shell(.sh) using the same .bat file. Can you help?

my .bat file contains and it worked fine

E:\Share\putty.exe -ssh username@ip -pw password

bat is BATCH
sh is SHELL/BASH

Unless you are on a *nix like machine, or windows within a cygwin, you wont be able to run the shell script.

You upload the shell script first to the *nix machine.
Then you call your bat file, which calls putty.
But give putty some more args, like -e /remote/path/to/script .
See putty /help for more details (if its -e as well) about execute a command.

hth

Press F1 and read the manual.

Daer All,

Thanks for the support you all given and I met my requirements. Did it using plink as you suggested.

followed this pattern

D:\plink.exe -load ns IP -l user-pw password /path to shell/shellname.sh