1

I am using putty in windows. I am logging to putty with an IP:Port number. What I have to do is I have to write a script which will open another putty terminal and do login there with its username and password

Purpose:- I am trying to automate my work using scripts, I have five users with there username and password and all of the terminal should be opened in putty and so there task. please guide me in this direction.

I am running my script in ssh shell

My code:- putty.exe -pw "password" [email protected] hello.sh ok-1

I have only executable file of putty, I have not installed putty, just copy and paste the exe file from another machine.Its working fine manually.

1
  • Where do you run your script for opening putty window? Windows console or ssh shell? Commented Oct 11, 2012 at 2:05

2 Answers 2

1

There are ways to automate this task but they may not be what you were originally anticipating.

You can pass username and password information to PuTTY via the windows command line.

putty.exe [email protected] -pw password

Alternatively you can preload the information in a windows shortcut by passing PuTTY.exe parameters. (More information availible in this answer: https://superuser.com/a/44117)

Both of these approaches mean storing plain text passwords which is not desirable. You should combine one of these methods with public key authentication. Say you choose windows shortcuts, you could have one for each user, the shortcut passing PuTTY the username, and the authentication is handled by stored SSH keys.

(A guide to SSH keys using PuTTY: http://www.howtoforge.com/how-to-configure-ssh-keys-authentication-with-putty-and-linux-server-in-5-quick-steps)

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the reply but after then I have to run a script, how to do that ? I have edited my code, please check that.
0

It is hard and bad idea to try to open another putty from within the ssh shell. My suggestions, pick one that's easier for you:

  1. open putty windows with windows batch .bat.
  2. use background command of shell.
  3. open a screen and use multiple screen sessions/windows.

1 Comment

Thanks for the reply, but I have to run some linux commands in all screens which will also be automated. can this be done with batch file..??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.