Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: Error accessing SFTP site from server, yet works from PC

$
0
0
Hi,
I have an issue trying to connect to a SFTP server, where I get the error:=
"Error! No suitable authentication method found to complete authentication."
The weird thing is that when I deploy my application (it is a windows service) to my local PC it works perfectly, but deployed to a server, I get the above error.
Any thoughts??? Code below....
Thanks
Paul

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Renci.SshNet;
using System.IO;

namespace TestSFTP
{
class Program
{
    static void Main(string[] args)
    {
        Stream s = File.OpenRead(@"\\rhea\itshared\Software Support\Landscape\MID\Identity");
        PrivateKeyFile p3 = new PrivateKeyFile(s, "Canopius99");
        PrivateKeyAuthenticationMethod pram = new PrivateKeyAuthenticationMethod("cmid0038cano", p3);
        ConnectionInfo c = new ConnectionInfo("194.60.191.31", 22, "cmid0038cano", pram);
        SftpClient client = new SftpClient(c);
        client.Connect();
        client.ChangeDirectory("from_xpn");  // change to where the files are on the target server
        var listdirectory = client.ListDirectory(client.WorkingDirectory,null);
        foreach (var fi in listdirectory) // Check to see if there us a file to process.....
        {
            System.Console.WriteLine(fi.FullName);
        }
        client.Disconnect();
    }
}
}

Viewing all articles
Browse latest Browse all 1729

Trending Articles