su wants to use a tty for everything, so it’s difficult to automate privileged commands. On most UNIX systems,
echo '<password>' | su <user> -c '<command>' is sufficient to authenticate privileged commands. Yet in Haiku OS, there appears to be no way to supply passwords in an automated fashion to su. su seems to hardcode receiving passwords from a tty device, rather than reading them from STDIN. Nor is there sudo package for Haiku.
One workaround might involve writing an expect script, however in practice I’ve never gotten the syntax to work correctly.