Results 1 to 10 of 18
Hi to all,
I need to make an mass-ssh connection.
I mean that;
I have a text file that thousand IP addresses. I need to make ssh connection to this ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-24-2012 #1Just Joined!
- Join Date
- Feb 2008
- Posts
- 13
Mass ssh connection..
Hi to all,
I need to make an mass-ssh connection.
I mean that;
I have a text file that thousand IP addresses. I need to make ssh connection to this ip address one by one. I will create a text file each ssh server.
Thanx for your help.
- 08-24-2012 #2You must always face the curtain with a bow.
- 08-24-2012 #3Just Joined!
- Join Date
- Feb 2008
- Posts
- 13
Thanx for your answer.
My problem is not enter password. All servers have public key (Of course i have a master) I don't need to enter password for ssh connection for this servers.
My problem is how to make a connection to this IP addresses. for example ssh root@44.33.33.22. I must use a text file to give IP 's to ssh command in a bash script. Like that
This is stupid i know)
ssh root@$SERVERS
I think a shell script while should help me..
- 08-24-2012 #4
Read the man page for pssh.
I believe, -h switch is what you want.
man page pssh section 1
Code:man parallel-ssh
Last edited by Irithori; 08-24-2012 at 10:37 AM. Reason: on debian, it is not pssh but parallel-ssh
You must always face the curtain with a bow.
- 08-24-2012 #5Just Joined!
- Join Date
- Feb 2008
- Posts
- 13
Thanx again,
Actually i must to make this using shell script or ssh. Because my company rules not allow install an another package.
Is there any idea to do that using shell script?
- 08-24-2012 #6
Of course one can implement a loop in bash.
But you would need to code any needed feature yourself, hence it needs development and debugging time.
pssh is a well known and tested python script with a lot of usefull features.
It is available via the debian standard repository and you only need to install it on one machine (the one which connects to to the thousand machines)
So if the choice is between installing one small tool via standard methods and start using itCode:cat /etc/debian_version 6.0.5 apt-cache search pssh pssh - Parallel versions of SSH-based tools
or reinventing the wheel by coding it in bash, then testing/debugging and only then start using it,
I would for sure go for the first option.You must always face the curtain with a bow.
- 08-24-2012 #7Just Joined!
- Join Date
- Feb 2008
- Posts
- 13
you are right.
pssh is simple way to do it.
My scripting experience is not enough for write this kind of script.
Is there any friend to hep me about this shell script?
- 08-24-2012 #8
In order for anyone to help you,
you might want to specify exactly what this script shall be capable of.
From the top of my head:
- Do you want parallel execution? Probably yes if there are a thousand machines. But then you need a way to set a limit on the parallel threads.
- Is each of the connection independend from the others or are there dependencies?
- What shall happen with stdout and stderr of each connection?
- What happens for a timeout or connection refused?
- That textfile, you want to create on the remote machines: Where, which permisions, which user, which content?
- Is there a need to restart or signal a daemon after the file has been placed?
There are for sure more points.
It would also be good if you already start working on a script and then post it here, so that members can see where you want to go.You must always face the curtain with a bow.
- 08-24-2012 #9Just Joined!
- Join Date
- Feb 2008
- Posts
- 13
Hi again,
Paralel connection is not must. I have too many time, operation can take a long time, it's not problem.
I will give a time out to ssh, 10 seconds timeout is a reason to next host.
Textfile contains hosts, i will not create it. It's already created.
Host don't need to restart.
I will start a command on ssh with a ssh parameter. For example; i 'll create a text file on remote host. It's not complex operation.
I only need to know how to give ip address to ssh command from a text file using shell script.
It's important for me.
Thanx for your helps.
- 08-24-2012 #10Just Joined!
- Join Date
- Oct 2006
- Posts
- 32
Try mass.pl - very useful perl script.


Reply With Quote
