I have a script fixa.sh deployed in all my client machine. I want to run this script from my jump host through a for loop script. Script on execution, prompts for sudo password. How can i make it as non interactive execution on jump host just be reading the password while executing.

I know if it is a sudo command i can make execute like

echo -n password: 
read -s password
ssh -t hostname 'echo $password | sudo -s <Command>'

But not sure how can i make the same way to execute script.


If you're fine with compromising the security a little, change the sudoers rule such that it doesn't prompt for password.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.