Skip to content

curl with sftp does not honor Port in ssh config file #9285

@Ben-Voris

Description

@Ben-Voris

I did this

I must connect to a system running ssh on a non-standard port. Passing sftp://user@host-name:port to curl works.

But I have a number of makefiles that get the host in an env variable. I.e., the command really is sftp://$(USER)@$(HOST).

I could put the port in the HOST env variable, but that same env variable is expanded and passed to ssh which requires that the port be passed with the '-p' option.

I put the port number in ~/.ssh/config like so:

Host host-name
        Port 2345

"OpenSSH_9.0p1, OpenSSL 1.1.1q 5 Jul 2022" and "OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022"
honor this but curl does not.

I expected the following

curl to honor the Port value from ssh config.

curl/libcurl version

Cygwin

curl 7.84.0 (x86_64-pc-cygwin) libcurl/7.84.0

OpenSSL/1.1.1q zlib/1.2.12 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.3 libpsl/0.21.1 (+libidn2/2.3.1) libssh2/1.10.0 nghttp2/1.48.0 libgsasl/1.8.0 OpenLDAP/2.6.3
Release-Date: 2022-06-27
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli Debug gsasl GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos
Largefile libz NTLM NTLM_WB PSL SPNEGO SSL threadsafe TLS-SRP TrackMemory UnixSockets zstd

Ubuntu

curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0

OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.12
Release-Date: 2022-01-05
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 NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets zstd

operating system

CYGWIN_NT-10.0-19042 LNCECL5HRV 3.3.5-341.x86_64 2022-05-13 12:27 UTC x86_64 Cygwin under Windows 10.

And

Linux 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions