user5025151
user5025151

Reputation:

C# Simple SSH Connection And Send Command

this is the code i'm using

SshClient cSSH = new SshClient("192.168.10.144", 22, "root", "pacaritambo");
cSSH.Connect();
SshCommand x = cSSH.RunCommand("exec \"/var/lib/asterisk/bin/retrieve_conf\"");
cSSH.Disconnect();
cSSH.Dispose();

but i want to send command from a textbox so I've tried this

SshCommand x = cSSH.RunCommand(textbox3.Text);

but didn't work basically i want textbox3.Text as a ssh command.

Upvotes: 0

Views: 714

Answers (1)

Oscar
Oscar

Reputation: 13960

Use:

SshCommand x = cSSH.RunCommand(textbox3.Text);

Without quotes.

Upvotes: 1

Related Questions