title: Sudo Command in the C# SSH .Net library
body: <p>This is the simplest sudo implementation of the SSH .Net library I can find.  However, I can not get it to work.</p>
  
  <pre><code>    using (var ssh = new SshClient("hostname", "username", "password"))
          {
              ssh.Connect();
              var input = new MemoryStream();
              var sr = new StreamWriter(input);
              var output = Console.OpenStandardOutput();
  
              var shell = ssh.CreateShell(input, output, output);
              shell.Stopped += delegate
              {
                  Console.WriteLine("\nDisconnected...");
              };
  
              shell.Start();
              sr.WriteLine("sudo ls");
              sr.Flush();
              Thread.Sleep(1000 * 1);
              sr.WriteLine("password");
              sr.Flush();
              Thread.Sleep(1000 * 100);
              shell.Stop();
          }
  </code></pre>
  
  <p>I get the following error everytime</p>
  
  <p>last login: Wed Jan 14 15:51:46 2015 from mycomputer</p>
  
  <hr>
  
  <p>company stuff</p>
  
  <hr>
  
  <p>SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'ChannelDataMessage': 'SSH_MSG_CHANNEL_DATA : #0'.
  SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'ChannelDataMessage': 'SSH_MSG_CHANNEL_DATA : #0'.
  [1;36mThis is BASH [1;31m4.1[1;36m- DISPLAY on [1;31m:0.0[m</p>
  
  <p>Wed Jan 14 15:55:50 CST 2015
  SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'ChannelDataMessage': 'SSH_MSG_CHANNEL_DATA : #0'.
  SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'ChannelDataMessage': 'SSH_MSG_CHANNEL_DATA : #0'.
  <strong>-bash: And,: command not found</strong>
  [0;34musername@host [0;31m[15:55:50]>[0m </p>