P: Tells pssh to display output as it arrives. Options: -I: Read input and sends to each ssh process. If the file hosts.txt has a large number of entries, say 100, then the parallelism option may also be set to 100 to ensure that the commands are run concurrently: pssh -i -h hosts.txt -p 100 -t 0 sleep 10000 Usage & run a command without checking or saving host keys: pssh -h hostname_ip.txt -x '-q -o StrictHostKe圜hecking=no -o PreferredAuthentications=publickey -o PubkeyAuthentication=yes' -i 'uptime hostname -f' Run commands via a script on multiple servers: It provides features such as sending input to all of the processes, passing a password to ssh, saving the output to files, and timing out.Ĭonnect to host1 and host2, and print "hello, world" from each: pssh -i -H "host1 host2" echo "hello, world" One simple & easiest way is via pssh (parallel ssh program) pssh: is a program for executing ssh in parallel on a number of hosts. There is are multiple ways to execute the commands or script in the multiple remote Linux machines. It should therefore not be applied in a security sensitive environment. Note that this disables certain security checks, for example protection against man-in-the-middle attack. If you do not want to have the host added to the known hosts file, add the option -o UserKnownHostsFile=/dev/null. This will disable the host key check and automatically add the host key to the list of known hosts. You can add the StrictHostKe圜hecking=no option to ssh: ssh -o StrictHostKe圜hecking=no -l username hostname "pwd ls" When ssh'ing to the remote machine, how to handle when it prompts for RSA fingerprint authentication. You can do this with ssh, for example: #!/bin/bash How can this be done using shell scripting? There are multiple remote linux machines, and I need to write a shell script which will execute the same set of commands in each machine.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |