0 votes
by (8.4k points)

How I can use Rebex SFTP with Mono?

My question is mainly around how to make sure Rebex gets included when I run the "gmcs" command.

Can you tell me what I need to do to get a basic SFTP script to work?

Applies to: Rebex SFTP

1 Answer

0 votes
by (58.9k points)
Best answer

Firstly, you need to download and install the trial Sftp package.

UPDATE: since 2013R3 you can use either Windows installer or install from zip archive.

Sorry, currently we only offer the Windows installer. If you do not have access to a Windows computer, so you could not install there and copy the dlls to the target UNIX machine, please let us know at support@rebex.net and we will send you the ready-to-use package.

We will be adding Mono installer in the next release (2013R2).

The .NET version of Rebex components is compatible with Mono, so either pick .NET 2.0 or .NET 4.0 version of the dlls.

Here is a basic C# program which will connect, login to SFTP server and download a file:

using System;
using Rebex.Net;

namespace MonoSftpBasic
    class Program
        static void Main(string[] args)
            Sftp sftp = new Sftp();
            sftp.Login("username", "password");

            sftp.Download("remoteFile", "localPath");


If you want to compile the above program with gmcs, you would have to use -r option to specify path to Rebex dlls (Rebex.Common.dll, Rebex.Networking.dll and Rebex.Sftp.dll). You can do it like this:

gmcs Program.cs -r:Rebex.Common.dll -r:Rebex.Networking.dll -r:Rebex.Sftp.dll

The resulting Program.exe can be run with mono like this:

mono Program.exe.