Running a command a different user using `su` gives "standard in must be a tty"

Drop the lone dash (-) in your su command. That triggers su to ask for a login shell. A tty might be required by some program in your login chain.