Change the putty code to get machine and user name from a file


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Change the putty code to get machine and user name from a file
# 1  
Old 01-27-2010
Change the putty code to get machine and user name from a file

HI,
I have parsed a file and stored all my machine name and user name in a list.

Now I want to change in the putty code such that the machine name and user name can be passed through calling that one by one from tht list through an object. Then pass it to the place the putty takes user name and machine name as input .


please help
# 2  
Old 01-27-2010
Can I ask why you want to do this? If it's to connect without prompts, you can use the plink command line interface that is installed with putty. It allows you to open a connection using saved session entries and execute commands. This isn't exactly reading the connection info from a file, but it does work.
# 3  
Old 01-27-2010
Just pass it along at the command line, eg
Code:
C:\> C:\Program Files\PuTTY\putty.exe user@host

# 4  
Old 01-28-2010
Ahh, you are correct. I was thinking he didn't want to put in the user and password, but he does. That will work well. Smilie
# 5  
Old 01-28-2010
require to save my time

Quote:
Originally Posted by dday
Ahh, you are correct. I was thinking he didn't want to put in the user and password, but he does. That will work well. Smilie
Actually , I need to connect to 37 machines one by one . So i want to do something like put all username and machine name in a file and pass it to putty as I want like :

1. 12 Machines of a Daemontype 1* I have
2. 12 Machine of Daemon type 2* I have
3. 12 Machine of Daemon type 3* I have
4. 1 machine of daemon type A i have

Now every machine have a differnt name and host pass is same for all, I manaully have to loging and at the crunch time i mistype the user name and machine name .

Now If some how I can make it easier like :
1. Put every machine name and user name in a file in an order.
2. parse the file and Collect it in a list.
3. When I run the program then it prompts me like

1. For which Daemon u want to open the putty
Daemon type 11
then the putty for that open only i need to give a password.
2. If i want to open machines in a group the
Daemon type 1* I need to pass and the complete gropu of 12 machines should open.
3. I dnt know can i give the password else i will pass it to as well.

Sm time it become very difficult for me to open each and every machine one by one and someone satnding on my head to see the issue is handled or not.

may be u got what i wanted to convey Smilie. Thanks
# 6  
Old 01-29-2010
This may sound like a lot of work, but after the initial setup you could be done. If you go into the Putty GUI and set up the connection information and save the session for each one to a unique name, then you could put a pline statement in a script for each session thereby connecting to each server.

I'm not sure if you can save the session information with just the host and username leaving the password field blank. If you can, then you can have your script ask for the password and save it to a variable and feed it into the command line with each pline.

Good luck
# 7  
Old 01-29-2010
You can also arrange password-less logins for ssh with keys. There's examples for that all over the internet.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

putty background colour change in vi editor

Hello, I have a problem with my putty session when i use the vi editor or when i do dbaccess on an Informix database. Suddenly the background and foreground colour of my terminal change and it makes it difficult for me to see whats on the screen. Why this is happening? Is there a way to keep... (2 Replies)
Discussion started by: omonoiatis9
2 Replies

2. UNIX for Dummies Questions & Answers

Change putty title name

Hello all, I have a not so unix question for you guys(or maybe it is). I use PUTTY to login to serverA (my putty title shows as serverA.domainname.com) Now from ServerA i do ssh user@ServerB (i have ssh public private key setup)... now my question is when i do ssh and logon to... (20 Replies)
Discussion started by: abdul.irfan2
20 Replies

3. Ubuntu

Login from putty in wndows7 to connect ubuntu machine

hi, i have ubuntu installed on windows 7. I am trying to connecting to ubuntu from windows 7 using putty but it is giving network problem. I am trying to connect with ip address Thanks (9 Replies)
Discussion started by: diehard
9 Replies

4. UNIX for Advanced & Expert Users

Change the window name for putty

Hi everyone , Happy new year ! I have a question , hope someone will respond to me . I will be logging into so many servers in the same putty . So , whenever i loggedoff and loggedin into anonther server , putty window will change accordingly to the server name . If the above is... (7 Replies)
Discussion started by: radha254
7 Replies

5. Solaris

Putty : Change default settings (solved)

Hi, I use to work on solaris via putty and always on session start - i use to increase the font to 14 bold - capture session output to a file my requirement) to make these changes permanent, so that i need not to change the settings everytime i connect via putty please advice. ... (0 Replies)
Discussion started by: saurabh84g
0 Replies

6. Homework & Coursework Questions

Simulate a ATM (cash machine) on UNIX(Putty) using scritps

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I need to create a simple ATM (Cash machine simulation in unix) which shows a welcome screen, then a login screen... (2 Replies)
Discussion started by: oobla01
2 Replies

7. Shell Programming and Scripting

Change user on remote machine and execute script!

Hi, I need to login into remote server and execute a shell script over there. As of now i am making use of ssh command ssh primUser@135.254.242.2 sh /poll.sh I am logging in as primUser but unless i change the user to root the script execution on the remote machine is not possible. ... (5 Replies)
Discussion started by: goutham4u
5 Replies

8. Solaris

putty to change screen colours

Can any one tell me how to change the screen colors of the screen when connected unix using putty. I tryed setting from colors but it's not happening (2 Replies)
Discussion started by: svenkatareddy
2 Replies

9. UNIX for Advanced & Expert Users

Change putty title window?

Is it possible to change the putty window title from a Unix command line? (12 Replies)
Discussion started by: akbar
12 Replies

10. UNIX for Advanced & Expert Users

scp from user A in machine 1 to user B in machine 2

Hi all, would like to find out how can i scp a file from user A in one host to user B in another host? i know how to get it done if its from user A in machine 1 to user A in machine 2. 1)on machine 1, generate a key pair. put the private key in the .ssh directory. 2)put the public key in... (2 Replies)
Discussion started by: new2ss
2 Replies
Login or Register to Ask a Question