How to build the latest curl from sources to allow downloading files via sftp?

k0pernikus

I need to download files from a sftp server. Unfortunately, the curl version in Ubuntu

7.58.0-2ubuntu3.6 amd64

does not support sftp.

I get the error message

Protocol "sftp" not supported or disabled in libcurl

when trying to download a file. I therefore want to build curl from source to allow sftp. How do I achieve that?

k0pernikus

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.

https://www.libssh2.org/download/libssh2-1.8.2.tar.gz

Extact and install it via:

cd libssh2-1.8.1
./configure
make
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 master.

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:

./buildconf
./configure
./configure --disable-libcurl-option --disable-shared --with-libssh2=/usr/local 
make
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
Release-Date: [unreleased]
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:

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Downloading a file from a remote server via SFTP using OutputStream (android)

From Dev

How to list files and only files via SFTP?

From Dev

Downloading files from SFTP server listed by remote command with Paramiko in Python

From Dev

curl not downloading the desired files

From Dev

How can I decrypt a password in SFTP file downloading from java

From Dev

How to build scene builder from openjfx sources

From Dev

C program for downloading files with curl

From Dev

C program for downloading files with curl

From Dev

download file with curl via sftp

From Dev

download file with curl via sftp

From Dev

How to stop embedded HTML files from downloading?

From Dev

failed to download the latest files using PHP, ssh2 via SFTP

From Dev

How to download only the latest file from SFTP server with Paramiko?

From Dev

What would be the best practice downloading all the files from a directory using Sftp

From Dev

What would be the best practice downloading all the files from a directory using Sftp

From Dev

How to download parts of the same file from different sources with curl/wget?

From Dev

Downloading files from URL

From Dev

How to build and install latest SimpleScreenRecorder from git?

From Dev

How to build and install latest SimpleScreenRecorder from git?

From Dev

How to skip missing files when downloading multiples files from the web?

From Dev

Size of file differs when downloading via curl

From Dev

How can I transfer files from my local system to another via a gateway system (and vice versa) fia SSH/SFTP?

From Dev

How to stop maven from downloading some jar files from repositorty

From Dev

Git: How to download latest version of repository files without downloading the whole repository?

From Dev

How to get a latest files from a different location

From Dev

How to change VIMRUNTIME directory after build from sources

From Dev

How does one build android kernel from sources on Ubuntu 13.04

From Dev

How does one build android kernel from sources on Ubuntu 13.04

From Dev

How to build all my installed package from sources?

Related Related

  1. 1

    Downloading a file from a remote server via SFTP using OutputStream (android)

  2. 2

    How to list files and only files via SFTP?

  3. 3

    Downloading files from SFTP server listed by remote command with Paramiko in Python

  4. 4

    curl not downloading the desired files

  5. 5

    How can I decrypt a password in SFTP file downloading from java

  6. 6

    How to build scene builder from openjfx sources

  7. 7

    C program for downloading files with curl

  8. 8

    C program for downloading files with curl

  9. 9

    download file with curl via sftp

  10. 10

    download file with curl via sftp

  11. 11

    How to stop embedded HTML files from downloading?

  12. 12

    failed to download the latest files using PHP, ssh2 via SFTP

  13. 13

    How to download only the latest file from SFTP server with Paramiko?

  14. 14

    What would be the best practice downloading all the files from a directory using Sftp

  15. 15

    What would be the best practice downloading all the files from a directory using Sftp

  16. 16

    How to download parts of the same file from different sources with curl/wget?

  17. 17

    Downloading files from URL

  18. 18

    How to build and install latest SimpleScreenRecorder from git?

  19. 19

    How to build and install latest SimpleScreenRecorder from git?

  20. 20

    How to skip missing files when downloading multiples files from the web?

  21. 21

    Size of file differs when downloading via curl

  22. 22

    How can I transfer files from my local system to another via a gateway system (and vice versa) fia SSH/SFTP?

  23. 23

    How to stop maven from downloading some jar files from repositorty

  24. 24

    Git: How to download latest version of repository files without downloading the whole repository?

  25. 25

    How to get a latest files from a different location

  26. 26

    How to change VIMRUNTIME directory after build from sources

  27. 27

    How does one build android kernel from sources on Ubuntu 13.04

  28. 28

    How does one build android kernel from sources on Ubuntu 13.04

  29. 29

    How to build all my installed package from sources?

HotTag

Archive