I have an a SSH server where root login is disabled. I'm hoping to run a privileged command that will want input from a file I have after being executed. I'm hoping to do all without user interaction via a oneliner command or a script
There is key auth setup, so the below password is requested only for running the command.
The closest I have gotten is this
echo "mypass" |ssh -tt user@ip "sudo specialCommand"
The output will look like
mypass [sudo] password for user: specialCommand requests inputfile contents
mypass is printed before and also accepted for the password prompt
I have the file
commandInput which I'm trying to pipe in after the password is accepted
I've failed with various attempts that were really just a guessing game, how can I achieve this?