Commands.page Logo

Configure aria2 Peer Agent String for Torrents on Ubuntu

This guide explains how to configure the aria2 download utility on Ubuntu to use a custom peer agent string when downloading torrents. You will learn how to edit the configuration file or use command-line arguments to mask your client identity, ensuring privacy and compatibility with specific trackers that require certain agent strings.

Install aria2 on Ubuntu

Before configuring, ensure aria2 is installed on your system. Open your terminal and run the following command to install the package using the Apt package manager:

sudo apt update
sudo apt install aria2

Set Peer Agent via Command Line

To set a specific peer agent string for a single torrent download session, use the --peer-agent flag followed by your desired string. This method is useful for one-off downloads without altering global settings.

aria2c --peer-agent="CustomAgent/1.0" --bt-metadata-only=true --bt-save-metadata=true "magnet_link_or_torrent_url"

Replace CustomAgent/1.0 with the specific user agent string you wish to broadcast to peers.

Set Peer Agent via Configuration File

For a permanent configuration, edit the aria2 configuration file. If the file does not exist, create it in your home directory.

  1. Open or create the configuration file:

    nano ~/.aria2/aria2.conf
  2. Add the following line to the file:

    peer-agent=CustomAgent/1.0
  3. Save the file and exit the editor.

Any future torrent downloads initiated by aria2 will now use this peer agent string by default.

Verify the Configuration

To confirm that the peer agent string is active, you can start a download and monitor the network traffic using a tool like Wireshark, or simply check the aria2 log output if verbose logging is enabled. Ensure that the configuration file is being read by starting aria2 with the -conf flag if you stored the file in a non-standard location.

aria2c --conf-path=~/.aria2/aria2.conf "magnet_link_or_torrent_url"

By following these steps, you have successfully configured aria2 to utilize a specific peer agent string on your Ubuntu system.