Skip to content

Instantly share code, notes, and snippets.

@cejojohn
Last active May 18, 2021 12:56
Show Gist options
  • Save cejojohn/5bb3b9528c248d8a16a18274c0c1e53b to your computer and use it in GitHub Desktop.
Save cejojohn/5bb3b9528c248d8a16a18274c0c1e53b to your computer and use it in GitHub Desktop.
pass='YOURPASSWORD'
for host in `cat ips`
do
sshpass -p $pass ssh -o ConnectTimeout=1 -o StrictHostKeyChecking=no -o GSSAPIAuthentication=no root@$host "hostname"
done
### Using encoding to escape Shoulder Surfing ;)
vim tempfile
#In the file write your password
cat tempfile | openssl enc -base64
#This will give you the encoded string of your password
#Paste the copied string from above to the below variable
pas='BASE64OFYOURPASSWORD'
sshpass -p `echo $pas | openssl enc -base64 -d` ssh root@host "hostname"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment