In general, it's recommended to use the high-level
Scripting object for these kind of tasks - see the sample code for this feature for details.
When using the low-level
SshChannel object to run the
sudo command, you have to request a pseudo-terminal by calling
channel.RequestPseudoTerminal() method before calling
sudo command is generally supposed to only be run by users connected through a terminal and will complain if
RequestPseudoTerminal has not been called.