How to create a magnet link to share files with friends via torrent
This is a very short tutorial to a very good way of quickly sharing files with your friends. I will share how to create and share magnet links via ctorrent and transmission-cli. Click on the links to jump to the part of the post that matters.
Why create a torrent instead of uploading it to a commercial cloud storage service?
If you went to a “higher education institution”, you probably have an institutional e-mail and you can access two of the main cloud storage providers. If you didn’t, you still probably have had an account on one or both of them at some point of your life. However, using them nowadays might be problematic.
Recently, Google has decided to severely limit its Drive storage for education institutions to ridiculously small amounts, and Microsoft’s OneDrive also requires a mandatory two-factor identification using a 2FA key or a phone number, which raises privacy concerns. Dropbox provides 2 Gb of storage, which is decent enough for most applications, but personal accounts do not have zero-knowledge encryption, so you would need to further encrypt your files yourself before the upload for them to be technically private.
You can definitely use commercial services offered by privacy-respecting companies, such as Proton Drive, NordLocker, Tresorit, Sync.com, Mega, or even better, host your own Nextcloud server. But you will have to create an account for any of those, or set up your own server and open ports on your own network so your friends can have access to your data. Personally, I prefer to keep the number of accounts I own to a minimum and not expose my self-hosted services to the internet. True, I could give people a WireGuard key to connect to my home network, but it is pretty obvious why this isn’t a great idea.
But here comes the most important reason of all: maybe you will have fun doing this via torrent and learn something new!
In summary, the whole process is very simple and consists of two steps:
- Create a
.torrent
file; - Add it to your torrent client to seed it.
To create a torrent file, we will need the file or directory that we are sharing (obviously) and a tracker (optional). According to wikipedia, “a BitTorrent tracker is a special type of server that assists in the communication between peers using the BitTorrent protocol”. A list of trackers can be found online, for instance here or here.
Alternative 1, ctorrent
I got this set of instructions from Ask Ubuntu forums, this post.
Just install ctorrent and run the following commands
ctorrent -t -u "http://tracker.example.com:6969/announce" -s example.torrent file_or_dir_to_upload
to create your tracker and
ctorrent example.torrent
to start seeding it.
Then share your file with your friends and they should be able to download it via torrent
Alternative 2, transmission-cli
I got this set of instructions from Linux Config, this post.
Install transmission-cli and run
transmission-create file_or_dir_to_upload -t udp://tracker.openbittorrent.com:80
to create your .torrent
and
transmission-remote -a file_or_dir_to_upload.torrent
to start seeding.
And voila! Just send the file over to your friends.
Converting torrent files into magnet links
To convert your .torrent
file into a magnet link, just copy the output of the following command
transmission-show -m yourfiles.torrent
and share it. You can pipe it to xclip
or a similar application and send it to someone as a text.
Relevant links
The information below was typed on Aug 15th, 2023, so prices and storage limits might be out of date. Regardless, it’s worth it considering the following services:
- Proton Drive, €3.99/mo; 200 GB, Free; 1 GB
- NordLocker, $3.99/mo; 500 GB, Free; 3 GB
- Tresorit, $10.42/mo; 200 GB, Free; 3 GB
- Sync.com, $96/yr; 2 TB, Free; 5 GB
- Mega, $5.45/mo; 400 GB, Free; 15 GB