0 votes
by (120 points)

I'm looking for a sftp client library which works under linux.
My infrastructure has a corporate http proxy with kerberos auth.
I wrote a small snippet for watching my remote sftp server directory.
Under Windows environment it works as expected.
Under Linux it raises exception of loading secur32.dll library.
How can i fix it ?

Unhandled exception. System.DllNotFoundException: Unable to load shared library 'secur32.dll' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libsecur32.dll: cannot open shared object file: No such file or directory
   at Rebex.Security.Authentication.SspiAuthentication.AcquireCredentialsHandle(String principal, String moduleName, SspiCredentialUsage usage, IntPtr logonID, gztda[] authData, IntPtr keyCallback, IntPtr keyArgument, IntPtr handle, Int64& timeStamp)
   at Rebex.Security.Authentication.SspiAuthentication..ctor(String package, SspiCredentialUsage usage, SspiDataRepresentation dataRepresentation, String targetName, SspiRequirements requirements, String userName, String password, String userDomain)
   at mupjf.zwslu.anfxg()
   at mupjf.zwslu.xijot(EndPoint p0)
   at Rebex.Net.ProxySocket.Connect(EndPoint remoteEP)
   at Rebex.Net.Sftp.ubddu(String p0, Int32 p1, SshParameters p2, bunkl p3)
   at Rebex.Net.Sftp.uysdv(Object p0, Enum p1, Object[] p2)
   at mupjf.jednh.eacwx(Object p0)
--- End of stack trace from previous location where exception was thrown ---
   at ConsoleApp1.Program.Main(String[] args) in C:\Users\kucherov\source\repos\ConsoleApp1\ConsoleApp1\Program.cs:line 30
   at ConsoleApp1.Program.<Main>(String[] args)

My snippet

    using var client = new Sftp
        Proxy = new Proxy
            AuthenticationMethod = ProxyAuthentication.Ntlm,
            Host = "my-corporate-proxy",
            LogWriter = new ConsoleLogWriter(LogLevel.Debug),
            Port = 8080,
            ProxyType = ProxyType.HttpConnect,
            Credentials = CredentialCache.DefaultNetworkCredentials

    await client.ConnectAsync("my-remote-sftp-server", 22);
    await client.LoginAsync("alex",
        new SshPrivateKey($"{Path.DirectorySeparatorChar}app{Path.DirectorySeparatorChar}id_rsa"));
    var list = await client.GetListAsync();
    foreach (var item in list) WriteLine(item.Name);
    await client.DisconnectAsync();
Applies to: Rebex SFTP

1 Answer

0 votes
by (144k points)


Unfortunately, Kerberos authentication is currently only supported on Windows.

by (120 points)
You misunderstood me kerberos auth to my corporate http proxy, not to sftp server.
Sftp server uses public key auth
by (144k points)
Unfortunately, this applies to HTTP proxy layer as well. We only support Kerberos on Windows. (However, I see that in your code, you actually use NTLM instead of Kerberos, and that might work on Mono in Linux, but not on .NET Core or .NET 5.)