我已经安装了 curl-7.27.0,它工作正常。但是,当我运行时curl -V,我得到:
curl 7.21.6 (i686-pc-linux-gnu) libcurl/7.21.6 OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
Run Code Online (Sandbox Code Playgroud)
如何启用 SFTP 协议?
Fra*_*que 16
您必须首先curl使用 sftp 支持进行编译。
下载并解压 curl 源代码。在那之后:
sudo apt-get install build-essential debhelper libssh2-1-dev sudo apt-get 源 libcurl3 sudo apt-get build-dep libcurl3 cd curl-x.xx.x/debian 纳米规则
找到并用“--with-libssh2”替换“--without-libssh2”
光盘.. 须藤 dpkg-buildpackage 光盘.. 须藤 dpkg -i curl_xxxxx.deb 须藤 dpkg -i libcurl3_xxxx.deb 须藤 dpkg -i libcurl3-gnutls_xxxx.deb
当然,使用适当的版本更新命令。更多信息在这里。
小智 7
如果找不到--without-libssh2替换,--with-libssh2可以搜索--without-ssl并追加 --with-libssh2,在Ubuntu 14.04.2上使用 curl 7.35.0版进行测试
Frantique 的定制答案:
下载并解压 curl 源代码。在那之后:
sudo apt-get install build-essential debhelper libssh2-1-dev
sudo apt-get source libcurl3
sudo apt-get build-dep libcurl3
cd curl-*/debian
nano rules
Run Code Online (Sandbox Code Playgroud)
Find --without-ssland append --with-libssh2,在我的例子中,它看起来像这样:
前
cd debian/build && dh_auto_configure ${CONFIGURE_ARGS} \
--with-ca-path=/etc/ssl/certs
cd debian/build-gnutls && dh_auto_configure ${CONFIGURE_ARGS} \
--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \
--without-ssl --with-gnutls
cd debian/build-nss && dh_auto_configure ${CONFIGURE_ARGS} \
--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \
--without-ssl --with-nss
Run Code Online (Sandbox Code Playgroud)
后
cd debian/build && dh_auto_configure ${CONFIGURE_ARGS} \
--with-ca-path=/etc/ssl/certs --with-libssh2
cd debian/build-gnutls && dh_auto_configure ${CONFIGURE_ARGS} \
--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \
--without-ssl --with-gnutls --with-libssh2
cd debian/build-nss && dh_auto_configure ${CONFIGURE_ARGS} \
--with-ca-bundle=/etc/ssl/certs/ca-certificates.crt \
--without-ssl --with-nss --with-libssh2
Run Code Online (Sandbox Code Playgroud)
现在构建包:
cd ..
sudo dpkg-buildpackage
cd ..
sudo dpkg -i curl_*.deb
sudo dpkg -i libcurl3_*.deb
sudo dpkg -i libcurl3-gnutls_*.deb
Run Code Online (Sandbox Code Playgroud)
有关 Frantique 答案的更多信息。
Frantique 的回答对我有用——但是当我尝试升级我的系统时,我的包管理器想要将安装恢复到没有 sftp/scp 的 curl。
为了避免每次升级后都必须使用 sftp/scp 重新安装 curl:
sudo aptitude hold libcurl3
sudo aptitude hold libcurl3-gnutls
Run Code Online (Sandbox Code Playgroud)
如果您使用 apt,请使用 apt-mark。
如果您想了解有关阻止更新特定程序包的更多信息,请阅读此页面。
请注意,在您取消保留之前,将来的某些升级可能无法继续进行。
如果碰巧您正在使用 PHP 并且需要在 curl 中使用 sftp - 您应该查看phpseclib,它可能更容易安装和维护。