I have a script running on a remote host through ssh, processing stdin from the host.
That is the script does something like this (to simplify):
cat $TARBALL | ssh $REMOTE 'tar -x -C -f - && reboot'
This work fine if I use root as the ssh user, but if I don't have root access on the REMOTE, I want to execute the command with sudo instead, eg:
cat $TARBALL | ssh $REMOTE 'sudo tar -x -C -f - && sudo reboot'
I would want the user to be asked the password interactively here, but sudo can't get the password in that situation.
How can I somehow instruct sudo to ask for the password on the local terminal? Seems like the -A option could enable this, but I can't figure what askpass program I might need in this case.