I need to execute the delete IP command ("sudo ufw delete 3") but after sending Ssh.net's RunCommand or CreateCommand & Execute, there will be no response and let me execute the next step, so I can't execute the command Y to delete, if I use putty it is It can be done by executing y after executing sudo ufw delete 3. By the way, is it possible to delete the specified IP.
string _host = "xxx.xxx.xxx.xxx";
string _username = "root";
string _password = "xxxxx";
int _port = 22;
SshClient sshClient = new SshClient(_host,_port,_username,_password);
if (!sshClient.IsConnected)
{
sshClient.Connect();
}
SshCommand sshCmd = sshClient.RunCommand($"sudo ufw delete 3"); <--- no response
sshCmd = sshClient.RunCommand($"y");
sshClient.Disconnect();
sshClient.Dispose()
I have test RunCommand on
SshCommand sshCmd = sshClient.RunCommand($"sudo ufw allow from {_IP} to any port 22");
This can work.But it doesnt need press "Y"