Reputation: 11
i use Tamir SharpSSH everything is working but i need to run command with c# code i put file server but i need to run command for works anybody know this ?
SshTransferProtocolBase sshCp;
const string sftp_host = "xxx";
const string sftp_user = "xxx";
const string sftp_pass = "xxx";
const int sftp_port = 22;
var sftp = new Sftp(sftp_host, sftp_user, sftp_pass);
sftp.Connect(sftp_port);
sftp.Put(@"D:\\" + Teslim + ".txt", "../");
sftp.Close();
this code working i need to run command into root????
Upvotes: 0
Views: 1824
Reputation: 31404
You can't execute a command with Sftp - you have to use an SSH console session to run commands. Tamir SharpSSH supports this with the SshExec
object.
See the SshExeText.cs sample for an example of using it.
Upvotes: 0