Skip to content

Instantly share code, notes, and snippets.

@marvin-marvin
Last active October 8, 2019 15:55
Show Gist options
  • Save marvin-marvin/e5e58ea01a6ff3e6b2eef2b1ba878a60 to your computer and use it in GitHub Desktop.
Save marvin-marvin/e5e58ea01a6ff3e6b2eef2b1ba878a60 to your computer and use it in GitHub Desktop.
check ssh on multiple servers from file
#check ssh login on multiple servers from file
for i in `awk '{print $3}' <STAGING>/FILE.txt`; do echo $i ; ssh -i <STAGING>/KEY -n root@$i "echo OK" ; done
#check ssh port on multiple servers from file
for i in `awk '{print $3}' <STAGING>/FILE.txt`; do echo $i ; nc -zw3 $i 22 && echo "opened" || echo "closed" ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment