I want to run a series of sudo-elevated commands on a remote machine from an embedded script. To simplify the question, I'm just trying to run sudo id and get it to tell me that it's root.
I am encountering "sudo: sorry, you must have a tty to run sudo" when I run this script:
#!/bin/bash ssh -t 192.168.1.100<<EOF sudo id EOF
But not when I run this:
#!/bin/bash ssh -t 192.168.1.100 sudo id
How do I get the first one, with the end-of-file designations for an embedded script to respect the forced tty at the other end of the SSH?