Hi,
I'm facing an error trying to invoke a very simple command via SSH to a Cisco WLC.
This command works great executing it via PuTTY (via SSH, and we also tested it via Telnet without any problem) in the same computer and with the same network conditions by the way.
Here is the log that I could get of REBEX library:
2016-02-17 17:30:31.925 Opening log file.
2016-02-17 17:30:31.925 Using FileLogWriter version 2.0.5885.0.
2016-02-17 17:30:32.299 INFO Ssh(1)[10] Info: Connecting to 172.16.48.10:22 using Ssh 1.0.5885.0 (trial version).
2016-02-17 17:30:37.360 DEBUG Ssh(1)[10] SSH: Server is 'SSH-2.0-CISCOWLC'.
2016-02-17 17:30:37.365 INFO Ssh(1)[10] SSH: Negotiation started.
2016-02-17 17:30:37.392 DEBUG Ssh(1)[10] SSH: Group exchange.
2016-02-17 17:30:37.396 DEBUG Ssh(1)[10] SSH: Negotiating key.
2016-02-17 17:30:37.471 DEBUG Ssh(1)[10] SSH: Received 2048-bit Diffie-Hellman prime (minimum allowed size is 1024 bits).
2016-02-17 17:30:37.613 DEBUG Ssh(1)[10] SSH: Validating signature.
2016-02-17 17:30:37.629 INFO Ssh(1)[10] SSH: Negotiation finished.
2016-02-17 17:30:37.629 INFO Ssh(1)[10] Info: Server: SSH-2.0-CISCOWLC
2016-02-17 17:30:37.629 INFO Ssh(1)[10] Info: Fingerprint: 47:80:9b:bc:ce:12:03:31:6d:18:05:b5:b3:07:bb:b9
2016-02-17 17:30:37.630 INFO Ssh(1)[10] Info: Cipher info: SSH 2.0, DiffieHellmanGroupExchangeSHA1, DSS, aes192-ctr/aes192-ctr, hmac-sha1/hmac-sha1
2016-02-17 17:30:38.918 DEBUG Ssh(1)[10] SSH: Authentication successful.
2016-02-17 17:30:39.573 DEBUG Ssh(1)[10] SSH: Executing command 'config netuser add TestTlfCortesia291479946 testing wlan 6 userType guest lifetime 3600'.
2016-02-17 17:30:39.589 ERROR Ssh(1)[10] SSH: Rebex.Net.SshException: The request has failed.
en Rebex.Net.SshChannel.IR(UBI U)
2016-02-17 17:30:39.596 ERROR Ssh(1)[10] Info: Rebex.Net.SshException: The request has failed.
en Rebex.Net.SshChannel.IR(UBI U)
en Rebex.Net.SshChannel.RequestExec(String command)
en Rebex.Net.Ssh.YGW(String U)
Here is the method that invoke the command:
public string CreateUser(string guestUser, string guestPassword)
{
try
{
var cmd = string.Format("config netuser add {0} {1} wlan {2} userType guest lifetime {3}",
guestUser, guestPassword, _ssidNumber.ToString(), _lifeTime.ToString());
string response = string.Empty;
using (var sshClient = new Ssh())
{
sshClient.LogWriter = new Rebex.FileLogWriter(
@"c:\logrebex.txt",
Rebex.LogLevel.Debug);
sshClient.Connect(_wdlcIp, _wdlcPort);
sshClient.Login(_wlcUser, _wlcPass);
response = sshClient.RunCommand(cmd);
}
return response;
}
catch (Exception ex)
{
throw ex;
}
}
Any help will be very appreciated.
Thanks.