Major noob here. I'm trying to write a connection string to run really basic commands and get the output. Can someone just show me the simplest way to do this using Razor view engine (.cshtml)? Below is my sad code:
Would someone be able to help me?
@using Renci.SshNet.Common;
@using Renci.SshNet.Channels;
@using Renci.SshNet.Compression;
@using Renci.SshNet.Sftp;
@using Renci.SshNet.Security;
@using Renci.SshNet.Messages;
@{
using (var sshClient = new SshClient("server", "user", "password"))
{
var terminal = sshClient.RunCommand("ls -l");
var output = terminal.Result;
}
}
This spits out the following error on the line "var terminal = sshClient.RunCommand("ls -l");": "Exception Details: System.ArgumentNullException: Value cannot be null." Would someone be able to help me?