Create a Torrent via SSH With mktorrent

Want to share files that are already on your App Hosting service, for example on a private tracker? Create the .torrent file right on the service with mktorrent: it reads the files at the speed of the server, so even large folders take only moments, and nothing has to be uploaded from your computer. mktorrent 1.1 is installed on our App Hosting services; the steps were tested on our demo service.

Connect over SSH first: SSH how to get connected.


1. Create the Torrent

mktorrent -p -l 20 -a "https://tracker.example.org/announce/your-key" -o ~/MyFolder.torrent ~/downloads/"My Folder"
  • -a: the announce address of the tracker. Private trackers show your personal address on their upload page; copy it exactly. Add more -a for backup trackers.
  • -p: private torrent, needed for most private trackers. Leave it out for public torrents.
  • -l 20: the piece size, as a power of two (see below).
  • -o: where to save the .torrent file.
  • Last, the file or folder to share. A folder becomes a torrent with all its files and subfolders.

Some trackers ask for a source tag; add it with -s "NAME". A comment goes in with -c "text". In our test, a 62 MB folder was done at once: Hashed 60 of 60 pieces.

2. Choose the Piece Size

A torrent is split into pieces. Aim for about 1000 to 2000 pieces; many trackers have their own rules, so check them first.

Total size        -l    piece size
up to 1 GB        19    512 KiB
1 – 4 GB          20    1 MiB
4 – 8 GB          21    2 MiB
8 – 16 GB         22    4 MiB
16 – 64 GB        23    8 MiB
more              24    16 MiB

Without -l, mktorrent uses 256 KiB, which gives far too many pieces for large torrents.

3. Check the Torrent

transmission-show ~/MyFolder.torrent

It shows the name, the piece count and size, whether the torrent is private, the source, the trackers and the files. In our test: Piece Count: 60, Piece Size: 1 MiB, Privacy: Private torrent.

4. Seed It

Download the .torrent file to your computer (for example with FileZilla) and upload it to your tracker, if the tracker asks for that. Many private trackers give you a new .torrent to download after the upload; use that one for seeding.

Then add it to ruTorrent so that it seeds the files that are already there:

  • In Add Torrent, set Directory to the folder that contains your shared folder, for example /home1/username/downloads for ~/downloads/My Folder. echo $HOME shows the full path of your home folder. Leave Don't add the torrent's name to the path unticked.
  • Add the .torrent file: ruTorrent: Add and Manage Torrents in Your Browser.

rTorrent checks the files and finds them complete: in our test, the torrent was at 100 % right after adding, without downloading anything, and started seeding. If it starts downloading instead, the directory is wrong: remove the torrent (without its data) and add it again with the right folder.

Prefer clicking to typing? MkTorrent WebUI on the Apps tab, and Create Torrent in ruTorrent, do the same in the browser.


Related Guides

View all SSH guides

Was this answer helpful? 0 Users Found This Useful (0 Votes)