Last active
November 16, 2020 22:13
-
-
Save gajoseph/c8930d8a2c5aeb86ebf4aeb457781415 to your computer and use it in GitHub Desktop.
script verifies that the ssh and sudo functionalities are workng as expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This script verifies that the ssh and sudo functionalities are workng as expected | |
*/ | |
sshme.sh:: contents are below | |
sshpass -p password ssh -tt -o LogLevel=error -q id@$host <<'EOF' | |
ls| wc -l | |
echo password | sudo -S su - postgres -c "ls|wc -l" | |
exit | |
EOF | |
### list of host names are stored in hosts.txt. contents are stored as below | |
SERV111 | |
SEVR123 | |
#######Run the command as below | |
while read line; do EXPORT host=$line; ./sshme.sh >> asdqwe.sh; done < hosts.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment