Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a list of linux machines, about 90 or so.

These are saved in a file as Host,USR,PW.
Is there a way I can read this list and then connect to each host and execute commands X, Y, Z

In the past I have touched each machine separately and just executed the commands by hand.
Takes FOREVER. There must be a better way.

share|improve this question
This question would be perfectly on-topic on Server Fault, where it has been asked many times already. – Gilles Dec 16 '10 at 23:00
up vote 1 down vote accepted

SSH batch mode should do it. Discussed here:

ssh -o "BatchMode yes" ramesh@remote-host who

to use usernames and passwords you might need to do some work with expect. using pre-shared keys is required for batch mode

share|improve this answer

You could use ssh with authentication keys.

So you could connect to every server with ssh and execute your commands.

Explained here ->

to read out the file you can use awk to filter only the hosts

cat file.txt | awk { print $1 } (don't know the file so this is an example)

share|improve this answer
yea but that means I would need to setup keys with every machine first =/ – madmaze Dec 16 '10 at 13:14
for sure. its an initial work, so after that it would make automation a lot more easier. If you have an Windows machine you could try with powershell and plink to achieve the same result (plink can be used with username and password) -> – patricks Dec 16 '10 at 13:20

Take a look at MCollective from Puppet Labs and the plugin shellcmd-agent.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .