SFTP travels over SSH. If SSH needs a proxy helper to reach the file server, put that route in a host entry and let SFTP use it.

Host files-via-proxy
    HostName files.example.net
    User alex
    ProxyCommand nc -X connect -x proxy.example.net:8080 %h %p

With an OpenBSD-compatible netcat helper, sftp files-via-proxy uses that connection path. The proxy listens on 8080; the requested destination port is the file server's configured SSH port. They are separate values. For a public SFTP server where public intermediaries are allowed, the HTTP proxy list offers candidates for the helper's HTTP proxy endpoint. Use no proxy credentials for an unauthenticated candidate and confirm that it permits the file server's actual host and SSH port.

SFTP's -P selects a destination port. Do not confuse it with the lower-case option used by some other SSH tools or put an arbitrary number after the destination and assume it changes the SSH connection.

Proxy authentication, SSH user authentication, and permission to access a remote file remain separate checks. The destination must also provide the SFTP subsystem. A working tunnel alone does not grant a file session, and an account restricted to forwarding-only operation is not necessarily usable for SFTP.

Keep host-key verification enabled. The proxy supplies a route; it should not replace the file server's identity with its own.

Ũhoro ũhĩtĩte