I'm able to run commands like "who" when testing, but when I try to run something like "services.sh restart" it just hangs. Running it using Putty works fine.
Thanks,
Adrian
Thanks,
Adrian
var connectionInfo = new KeyboardInteractiveConnectionInfo(host, username);
connectionInfo.AuthenticationPrompt += delegate(object sender, AuthenticationPromptEventArgs e)
{
foreach (var prompt in e.Prompts)
{
if (prompt.Request.Equals("Password: ", StringComparison.InvariantCultureIgnoreCase))
{
prompt.Response = password;
}
}
};
using (var ssh = new SshClient(connectionInfo))
{
ssh.Connect();
var cmd = ssh.RunCommand("services.sh restart");
Console.WriteLine(cmd.Result);
ssh.Disconnect();
}