2

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.

1

5 Answers 5

2

SSH batch mode should do it. Discussed here: http://www.thegeekstuff.com/2009/10/how-to-execute-ssh-and-scp-in-batch-mode-only-when-passwordless-login-is-enabled/

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

2

Func

ClusterSSH

2

See :

Fanout and Fanterm
DSH - distributed shell

1

You could use ssh with authentication keys.

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

Explained here -> http://www.debian-administration.org/article/SSH_with_authentication_key_instead_of_password

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)

2
  • yea but that means I would need to setup keys with every machine first =/
    – madmaze
    Dec 16, 2010 at 13:14
  • 1
    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) -> chiark.greenend.org.uk/~sgtatham/putty/download.html
    – patricks
    Dec 16, 2010 at 13:20
0

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

You must log in to answer this question.

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