I have more than 10 Linux machines. How may I power off all machines using a single script?
The password and user is the same for all of the machines.
There’s many mays to do it.
One option is to use ssh key pairs instead of passwords to ssh without prompting for password. Then, you can do this :
#!/bin/bash for server; do ssh $server 'halt; exit'; done
./script.bash server1 server2 18.104.22.168