From b559f300b86f9ee81d8cd7385d07af06e6e7b830 Mon Sep 17 00:00:00 2001 From: Harvie Date: Mon, 24 May 2010 23:46:49 +0200 Subject: [PATCH] Script to automatically open Cluster SSH to all machines in network --- bash/clusterssh-scan.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 bash/clusterssh-scan.sh 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 -- 2.30.2