Skip to content

Instantly share code, notes, and snippets.

View ganchuhang's full-sized avatar
race

Gan Chu Hang ganchuhang

race
View GitHub Profile
Console.WriteLine($"SSH Tunnel Start");
PrivateKeyFile[] key1 = new PrivateKeyFile[] { new PrivateKeyFile("C:\\Users\\Administrator\\.ssh\\fifasports2.pem") };
List<AuthenticationMethod> method1 = new List<AuthenticationMethod>();
method1.Add(new PrivateKeyAuthenticationMethod("centos", key1));
using (var ssh = new SshClient(new ConnectionInfo("1.1.1.1", "centos", method1.ToArray())))
{
ssh.Connect();