Can aria2 Download Files via SFTP?

The aria2 download utility fully supports downloading files over the SFTP (SSH File Transfer Protocol) alongside other protocols like HTTP(S), FTP, and BitTorrent. Credentials can be passed securely to the application using inline URI formatting, dedicated command-line flags, configuration files, or external credential management systems like .netrc.

Protocol Capabilities

When aria2 is compiled with the libssh2 dependency, it natively interprets sftp:// links. This enables users to perform segmented, high-speed downloads from secure remote servers just as they would from a web or standard FTP server.

Passing Credentials via inline URIs

The most direct way to pass authentication details to aria2 is by embedding the username and password explicitly within the transfer URI string:

aria2c "sftp://username:password@example.com:22/path/to/file.zip"

Dedicated Flags and Configuration Files

To prevent sensitive credentials from leaking into the shell history or process list via the URI string, alternative options exist:

SSH Key Support Limitations

Unlike native SSH or SCP clients, aria2 relies strictly on password-based authentication for SFTP transfers. While it provides options to verify the remote server identity (using flags like --ssh-host-key-md), it does not natively support logging in with public/private SSH key pairs (~/.ssh/id_rsa).