From: Harvie Date: Mon, 24 May 2010 21:46:49 +0000 (+0200) Subject: Script to automatically open Cluster SSH to all machines in network X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=b559f300b86f9ee81d8cd7385d07af06e6e7b830;p=mirrors%2FPrograms.git Script to automatically open Cluster SSH to all machines in network --- diff --git a/bash/clusterssh-scan.sh b/bash/clusterssh-scan.sh new file mode 100755 index 0000000..c28e275 --- /dev/null +++ b/bash/clusterssh-scan.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +scan_for_ssh() { + for i in $( seq 158 255 ); do + # echo 1 "$1"."$i" 22; + nc -z -w 1 "$1"."$i" 22; + if [ "$?" = 0 ]; then + echo -n "$1.$i "; + fi; + done; + echo; +} + +get_ssh_logins() { + for i in $( scan_for_ssh "$2" ); do + echo -n "$1"@"$i "; + done; + echo; +} + +get_ip_range() { + for i in $( seq 158 255 ); do + echo -n "$1.$i "; + done; + echo; +} + +#cssh $( get_ssh_logins root 192.168.2 ) + +cssh -T "Klub SSPS" root@192.168.2.161