I am attempting to develop a script that upgrades my VMs on a local network. The goal is for each VM to download the script and then execute it.
I have been able to use curl to download the script and execute, but I still receive a prompt to enter the password for sudo.
This works:
sshpass -p 'password' ssh -t -t [email protected] 'curl -s 192.168.1.15/upgrade.sh | sudo sh'
But I still have to enter a password again when it reaches the sudo command.
I've attempted:
sshpass -p 'password' ssh -t -t [email protected] 'curl -s 192.168.1.15/upgrade.sh | echo 'password' | sudo sh'
Which prompts the following:
[sudo] password for aaron: (23) Failed writing body
What can I do to pass the password to the sudo password prompt?
echo
not the sudo command.ps
and in your shell’s history.username ALL=(ALL) NOPASSWD: ALL
insudoers
wil also prevent asking for a password.