SocketException: Connection Refused for SFTP (SSH)

It’s really strange and even when enabling the --log-level=profiling Duplicati does not show any hint of what is happening behind the scenes. There is no firewall/port issue and I verified the config file of Duplicati (via the “export configuration” option) contains the SSH port number. I see two possible reasons for this issue:

  1. The version combination of Duplicati and Mono does not work well and therefore the connection is not working properly.
  2. Mono itself is somehow malconfigured (e.g. no permissions?) and cannot connect to the remote SSH server.

Using default Debian packages, the versions are as follows:

root@dat:~# apt policy mono-runtime
mono-runtime:
  Installed: 4.6.2.7+dfsg-1
  Candidate: 4.6.2.7+dfsg-1
  Version table:
 *** 4.6.2.7+dfsg-1 500
        500 http://ftp.de.debian.org/debian stretch/main amd64 Packages
        100 /var/lib/dpkg/status
root@dat:~# apt policy duplicati
duplicati:
  Installed: 2.0.4.5-1
  Candidate: 2.0.4.5-1
  Version table:
 *** 2.0.4.5-1 100
        100 /var/lib/dpkg/status

Firewall and port issues are out of the question as there is no magic going on when simply running the ssh command from command line works as expected.