Open bedus-creation opened 6 years ago
I am on linux how can I compile with --with-libssh2 I tried with
Yes, hmmmm. I am not an expert with Linux I am afraid. I have mostly used Arch which has always had the latest packages with the most flexibility.
In theory it is as you say. Download the source for libssh2 and compile, download the source for curl and compile with the flag --with-libssh2
. I had a bit of a go in a virtual machine to see how straightforward it would be. I couldn't get libssh installed in a place which could be found when compiling curl. You might have better luck with it though.
But as I say, I don't use curl with sftp support so maybe you don't need it either ? What are you trying to do that's not working as expected ?
The problem is that Ubuntu ships a version of curl that doesn't support SFTP. bug report. The only solution I could find, like you, is to compile it yourself. There are a few more tutorials:
I was able to use a self generated certificate like so:
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout ~/.ssh/vsftpd.key -out ~/.ssh/vsftpd.crt
curl -T file-to-upload -v --ftp-ssl --cacert ~/.ssh/vsftpd.crt --user myuser:password ftp://SERVER-IP/file-to-upload
I had to upload the certificate files vsftpd.key
and vsftpd.crt
to add them to /etc/vsftpd.conf
since I'm using vsftp
The problem I'm facing now is that git-ftp doesn't recognize --ftp-ssl
although that parameter is needed with curl as shown in the command above after generating the certificate.
@bedus-creation Have you solved the problem?
The problem is that Ubuntu ships a version of curl that doesn't support SFTP. bug report. The only solution I could find, like you, is to compile it yourself. There are a few more tutorials:
* http://zeroset.mnim.org/2013/03/14/sftp-support-for-curl-in-ubuntu-12-10-quantal-quetzal-and-later/ * http://andrewberls.com/blog/post/adding-sftp-support-to-curl
By default, the cURL
command is disabled for SFTP
protocol support on Ubuntu.
To have the cURL
command with SFTP
support on Ubuntu distribution, it should fetch cURL
source codes and recompile them.
Here is the Gist link for help someone to recompile cURL
package source on Ubuntu easily :).
All of files are tested well on Ubuntu 18.04
.
This Gist link includes following files:
build_curl_sftp.sh
file can use them directly on your Ubuntu operating system directly.Dockerfile
file can build a Docker image with cURL
command enabled SFTP
support and it can use cURL
command without polluting original cURL
command on host operating system.BTW, the cURL
command is enabled for SFTP
support on CentOS/RedHat distributions.
To verify cURL
command is enabled for SFTP
support, it can run following command to accomplish this:
curl -V | grep sftp
And the expected output will be:
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Enjoy it :)!
If you're using Git FTP to deploy an app using pipeline via SFTP, switching image from Ubuntu to Debian worked for me.
Ex.: git ftp push -u $FTP_USERNAME -p $FTP_PASSWORD $FTP_HOST
P.S.: $FTP_HOST = "sftp://127.0.0.1/var/www/html"
The problem is that Ubuntu ships a version of curl that doesn't support SFTP. bug report. The only solution I could find, like you, is to compile it yourself. There are a few more tutorials:
* http://zeroset.mnim.org/2013/03/14/sftp-support-for-curl-in-ubuntu-12-10-quantal-quetzal-and-later/ * http://andrewberls.com/blog/post/adding-sftp-support-to-curl
By default, the
cURL
command is disabled forSFTP
protocol support on Ubuntu.To have the
cURL
command withSFTP
support on Ubuntu distribution, it should fetchcURL
source codes and recompile them.Here is the Gist link for help someone to recompile
cURL
package source on Ubuntu easily :).All of files are tested well on
Ubuntu 18.04
.This Gist link includes following files:
build_curl_sftp.sh
file can use them directly on your Ubuntu operating system directly.Dockerfile
file can build a Docker image withcURL
command enabledSFTP
support and it can usecURL
command without polluting originalcURL
command on host operating system.BTW, the
cURL
command is enabled forSFTP
support on CentOS/RedHat distributions.To verify
cURL
command is enabled forSFTP
support, it can run following command to accomplish this:curl -V | grep sftp
And the expected output will be:
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Enjoy it :)!
Min ubuntu supported by github actions is 20.04, any updated version of this script?
EDIT: looks like installed curl version on ubuntu 24.04 (latest) has sftp support:
curl 8.5.0 libcurl/8.5.0 OpenSSL/3.0.13 zlib/1.3 brotli/1.1.0 zstd/1.5.5 libidn2/2.3.7 libpsl/0.21.2 (+libidn2/2.3.7) libssh/0.10.6/openssl/zlib nghttp2/1.59.0 librtmp/2.3 OpenLDAP/2.6.7
Release-Date: 2023-12-06, security patched: 8.5.0-2ubuntu10.1
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd
Yet same error
Since the Ubuntu 20.04
is released, the curl
is supported for the sftp
protocol.
And this issue will not be happened.
Is there any more information you can provide with this issue?
Curl is able to use the sftp protocol. If you are on a mac with homebrew there is a flag to compile curl with
libssh2
which gives support for sftp.Although I am using the curl installed with OSX which says that it doesn't have support for sftp but this has not been a problem for me.
What are you having trouble with ?