Search code examples
shellauthenticationsftpsocks

SFTP using SOCKS proxy command with password authentication


We need to make SFTP connection to download file through SOCKS proxy.

Trying below way but it's not working.

sftp -o ProxyCommand='/usr/bin/nc -v -xexamplesocksproxy.com:1080 %h %p' user@remote

We do have user name and password for SOCKS proxy authentication but not sure where to put it.

Any help would be appreciated.


Solution

  • Imo, nc does not support authentication.

    You will need to use another implementation. For example the ncat with its --proxy-auth switch.

    According to Is there a built-in way to proxy SSH through socks5?, this should do:

    sftp -o ProxyCommand='ncat --proxy-type socks5 --proxy-auth username:password --proxy examplesocksproxy.com:1080 %h %p' user@remote