I am currently writing a program in Go and trying to implement a switch user functionality. However, I can't find a clean way of sending a password via stdin to su. sudo -S allows for stdin password input, but as this requires sudo rules to be setup it isn't ideal. So:
- Is there a clean way of programmatically using su? OR
- Can sudo alone be used to switch users?