Changes in multiple machines at a time through scripting..!

Hello TecMint,

I have small question…
If i have five diff machines… like

How to set the host names for all machines at a time and password less SSH too.


Write those in a file (name it list.txt for example) , keep them in the same format as you have listed them. Then run the following:

for i in $(cat list.txt); do ssh user@$i command; done

Here is an example:

for i in $(cat list.txt); do ssh root@$i ‘free -m’ > /tmp/memory.status; done

Give any additional parameters to the SSH if you are using different SSH port or RSA DSA keys.


I think you should have a look at PSSH [][1]

PSSH allows you to execute the scirpt on multiple machines in the network.