0

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????

Cœur
  • 37,241
  • 25
  • 195
  • 267
omer oruc
  • 11
  • 3

2 Answers2

0

You can't execute code on a remote server via (S)FTP.

bluevector
  • 3,485
  • 1
  • 15
  • 18
0

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.

shf301
  • 31,086
  • 2
  • 52
  • 86