SUDO with ScpClient?

Feb 3, 2014 at 6:31 PM
Edited Feb 3, 2014 at 8:31 PM
edit... Nevermind! I was a dingus and didn't check the error of the SshCommand. I was expecting an exception. Turns out I got the "Sorry, you must have a tty to run sudo" error. The below is moot and I assume I need root access to be able to actually do this.

Is there a way to transfer files with root permissions using the sudo command? Thanks!

I've tried scping to a directory I do have access to and then moving the file to the appropriate directory via sudo -S. Unfortunately it doesn't seem like sudo -S does anything. Here's a snippet:
_renciClient.RunCommand( string.Format( "echo {0} | sudo -S mv /tmp {1}", password, moveToPath ) );
I've also tried:
_renciClient.RunCommand( string.Format( "echo \"{0}\" | sudo -S mv /tmp {1}", password, moveToPath ) );