Hello all !
I have a Raspberry Pi with SFTP enabled for one user which is "wifi". When I connect using Filezilla client, it works great. But when I use the WinSCP Library (the latest), it failed with
{WinSCP.SessionRemoteException: Cannot open file "\\.\nul". Accès refusé
at WinSCP.SessionLogReader.Read(LogReadFlags flags)
at WinSCP.ElementLogReader.Read(LogReadFlags flags)
at WinSCP.SessionElementLogReader.Read(LogReadFlags flags)
at WinSCP.CustomLogReader.TryWaitForNonEmptyElement(String localName, LogReadFlags flags)
at WinSCP.CustomLogReader.WaitForNonEmptyElement(String localName, LogReadFlags flags)
at WinSCP.Session.WaitForGroup()
at WinSCP.Session.Open(SessionOptions sessionOptions)
at DumboNetwork.Controllers.SFTP..ctor(String args)}
Here is the code used
sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = args,
UserName = "wifi",
Password = "password",
SshHostKeyFingerprint = "ssh-rsa 2048 6c:53:02:91:9f:08:3d:a1:d3:45:e5:67:8a:88:f8:14",
GiveUpSecurityAndAcceptAnySshHostKey = true,
PortNumber = 22,
};
client = new Session();
client.SessionLogPath = ApplicationData.Current.LocalFolder.Path + "\\" + "debug.log";
client.DisableVersionCheck = true;
int attempts = 0;
do
{
try
{
client.Open(sessionOptions);
}
catch (Exception e)
{
attempts++;
Debug.WriteLine(e);
}
} while (attempts < _connectionRetryAttempts && !client.Opened);
Can you help me ? Thanks !