Sftp Server implementation based on SSHServer library based heavily on FxSsh. This fork (based on https://github.com/0xFireball/SSHServer) implements the sftp subsystem and a Graphical user interface for administration of users and server settings.
All basic Sftp command are now implemented except handling symbolic links. However some implementations such as returning correct file attributes are not finalized. Server was tested with FileZilla client only. There are probably some bugs left to fix. You are welcome to create PR's
FxSsh is a lightweight SSH server side application as SSH reinforcement of GitCandy.
using FxSsh;
using FxSsh.Services;
using System;
using System.Text;
using System.Threading.Tasks;
namespace SshServerLoader
{
class Program
{
static async Task Main(string[] args)
{
await new HostBuilder()
.ConfigureServices((hostContext, services) =>
{
services.AddLogging();
Log.Information("Starting host service");
services.AddHostedService<HostedSftpServer>();
})
.RunConsoleAsync();
}
}
}
using Renci.SshNet;
using System;
using System.Net;
namespace TestClient
{
internal class Program
{
private static void Main(string[] args)
{
var testUsername = "test_person";
var testPassword = "1234";
var connInfo = new ConnectionInfo(IPAddress.Loopback.ToString(), 22, testUsername,
new AuthenticationMethod[]
{
// Password auth
new PasswordAuthenticationMethod(testUsername, testPassword)
}
);
using var sftpclient = new SftpClient(connInfo);
sftpclient.Connect();
sftpclient.ListDirectory("/");
sftpclient.Disconnect();
Console.ReadLine();
}
}
}
The MIT license