Note: Installing software from a third-party source is a safety risk. Make sure you trust the sources before following these steps.
First, you'll need libssh installed.
You'll need a tarball, e.g.
Extact and install it via:
sudo make install
Secondly, make sure to uninstall your existing curl:
sudo apt purge curl
I have read that it is also recommended to uninstall the curl libs, e.g.
libcurl3-gnutls, BUT I noticed that it has many dependencies I did not want to lose, so I kept it. So be careful about the uninstallation process.
And third, in order to build
curl from the sources, clone the curl project:
$ git clone https://github.com/curl/curl.git
I compiled it with commit hash
b8f760319668548d93ab0c023633293514d8137, please bear that in mind if you have problems with the current
That repository contains a
GIT-INFO file with useful information on how to build it and it may be useful to have a look into it, as the process may change in the future.
What worked for me was to build it via:
./configure --disable-libcurl-option --disable-shared --with-libssh2=/usr/local
sudo make install
curl supports uninstallation via
sudo make uninstall. Useful if you having problems or what to try out different flags.)
I didn't use shared libraries as I noticed that curl was having problems finding certain curl-own commands and failed when tryin to run it, e.g. I saw errors like:
curl: symbol lookup error: curl: undefined symbol: curl_url_cleanup
curl: error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory
Yet with the above mentioned approach I have now a working curl supporting sftp, since sftp shows up within the supported protocols:
$ curl -V
curl 7.64.1-DEV (x86_64-pc-linux-gnu) libcurl/7.64.1-DEV OpenSSL/1.1.0g zlib/1.2.11 libssh2/1.8.1
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL TLS-SRP UnixSockets
and I can confirm that it downloads file from sftp servers.
Sources: I found about the necessary steps via: