0 votes
by (120 points)

We are working with a device running windows embedded compact 7

we need to have remote access to this device, through a VNC EFON server. We want to implement a connection through an SSH tunnel using your REBEX SSH product (net cf 3.5)

To do this we need to install an SSH server in WEC7 that is compatible with the VNC EFON to be able to do the redirect.

Do you have an example of this? We downloaded this examples Rebex Components Legacy CF 2019 R3.4 - Samples, but we do not see something similar to what we are looking for.

Best regards

1 Answer

0 votes
by (145k points)

Hello, we have not been providing .NET CF samples for several years. However, Rebex API in the legacy .NET CF edition is a very big subset of the mainstream edition API, so mainstream edition samples can be adapted to .NET CF easily.

However, in order to launch an SFTP server, you really don't need much code beyond this. For example, try this to get started:

public static void Main()
    // port to listen at
    int port = 8022;

    // server's private key
    var key = new SshPrivateKey("key.ppk", "password");

    // set up a user with one of several file system providers
    var user01 = new FileServerUser("user01", "password", @"\Hard Disk\SFTP\user01");

    // create a server instance
    var server = new FileServer();

    // bind SFTP/SSH and SSH shell to port 8022
    server.Bind(port, FileServerProtocol.Sftp);
    server.Bind(port, FileServerProtocol.Shell);

    // add server key

    // add a user

    // use console log writer
    server.LogWriter = new ConsoleLogWriter(LogLevel.Info);

    // start server in the background

    // run the server
    Console.WriteLine("Server is listening at port {0}", port);
    Console.WriteLine("Press 'Enter' to stop.");

    // stop the server
    Console.WriteLine("Server has been stopped.");

To generate the key.ppk file, use SshPrivateKey class.

And to enable tunneling, just bind the appropriate subsystem and add an event handler.

However, please note that Rebex SSH server currently only supports outgoing SSH tunnels. Support for incoming tunnels is planned for one of the future releases.