---
deprecated: true
excerpt_separator: <br/>
category: technology
layout: post
title: BitTorrent, the Linux way
date: '2011-05-26T10:00:00.000-04:00'
author: Anna Wiggins
tags:
- tutorial
- bittorrent
- linux
- dropbox
- Technology
modified_time: '2013-10-22T11:19:50.897-04:00'
blogger_id: tag:blogger.com,1999:blog-4209116010564764361.post-8579340143964763744
blogger_orig_url: http://www.stringofbits.net/2011/05/bittorrent-linux-way.html
---

I use <a href="http://en.wikipedia.org/wiki/BitTorrent_%28protocol%29">BitTorrent</a> a lot. Most Linux distributions have torrents available, and I have gotten a lot of <a href="http://creativecommons.org/">Creative Commons</a>-licensed music, such as the work of <a href="http://www.jonathancoulton.com/">Jonathan Coulton</a>, via BitTorrent. It is a great way to deliver content.<br/><br/>However, I have a problem with (most of) the available BitTorrent clients. Given what BitTorrent <em>does</em>, which is allow you to download and subsequently seed content, it should really run like a service - quietly running in the background handling your torrents. However, most of the clients for Linux work like Windows applications. They sit in your system tray, giving you "helpful" popup notifications. More importantly, they die if you logout. Luckily, I have found a solution.<br/><h3>Enter transmission-daemon</h3><br/>Transmission is one of the bittorrent clients for Linux that works like I described above - it's a desktop application. However, it comes with a variant, transmisison-daemon, that can run in the background, as a dedicated 'transmission' user. This is much nicer.<br/><br/>Setting it up in fedora is pretty easy. Install the transmission-daemon package. Edit /etc/sysconfig/transmission-daemon to suit your needs. You can change TRANSMISSION_HOME to whatever directory you'd like your completed torrent files to live in (you <strong>do not</strong> need to modify the actual home directory of the transmission user, but do make sure TRANSMISSION_HOME is owned by that user).<br/><br/>Now, start transmission-daemon, then stop it again:<br/><pre>service transmission-daemon start<br/>service transmission-daemon stop</pre><br/>That step created the transmission configuration files, which you can now find in $TRANSMISSION_HOME/.config/transmission-daemon/. The file you probably want to edit is settings.json. Edit this file to suit your needs, then start transmission again. To tell transmission to automatically start at boot, run:<br/><pre>chkconfig transmission-daemon on</pre><br/><h3>transmission-remote - for all your transmission-related needs</h3><br/>So, now you have a daemonized BitTorrent client, running unobtrusively in the background. But how do you use it?<br/><br/>The answer is transmission-remote. This tool is an administrative front-end for transmission-daemon that lets you add, remove, start, stop, and view your torrents, and a lot more besides. To add a torrent, you can use 'transmission-remote -a' on either a local .torrent file or a URL, like so:<br/><pre>transmission-remote -a /path/to/file.torrent<br/>transmission-remote -a http://example.com/file.torrent</pre><br/>Once the torrent is added, it will automatically start. You can get information on all your torrents with 'transmission-remote -l'. Note that each torrent has a numeric ID assigned to it; you use that ID with the '-t' option to tell transmission-remote to perform actions on the torrent. For example, to stop the torrent with ID 42, you could run:<br/><pre>transmission-remote -t 42 -S</pre><br/>transmission-remote can do a lot more; check its man page for details. In particular, the -s, -i, and --remove-and-delete are useful flags to know.<br/><h3>Making things easier - the watch directory</h3><br/>The problem with the approach I have described is that the command line, while great for interacting with your local torrents, is not the place most people go to look for torrents in the first place. More often, you find a .torrent file on the web, and having to open a terminal and run a command is an annoying extra step.<br/><br/>To make things easier, you can set up a watch directory; any .torrent files placed in that directory will automatically be added to transmission-daemon. To set up a watch directory, edit settings.json and add the following:<br/><pre>watch-dir-enabled: "true",<br/>watch-dir: "/path/to/watch/dir",</pre><br/>(I have found it is best to always stop transmission-daemon before making changes to settings.json. It often overwrites settings at shutdown)<br/><br/>One caveat about the watch directory: when transmission-daemon is started, every .torrent file in there will be added. While this has no effect on torrents you are still downloading or seeding, torrents you have already removed will be re-added to transmission-daemon. For this reason, it is a good idea to routinely delete the files in your watch directory. You can use tmpwatch and/or cron to periodically delete the files.<br/><h3>Torrents from anywhere - using Dropbox with transmission-daemon</h3><br/><a href="http://dropbox.com">Dropbox</a> is a fantastic tool for always having access to important files. Any files you put in your dropbox directory get automatically synced to every machine you use dropbox on. There are also Android, iOS, and web interfaces, so you can really get to your files from anywhere.<br/><br/>What does this have to do with transmission? Well, you can put your watch directory inside your dropbox directory. Any .torrent file you add to that directory - from any computer or phone - will automatically be started on the computer running transmission-daemons. This means you can start your torrents whenever you come across them, no matter where in the world you happen to be.<br/><br/>And if you have multiple people in your household who might all like to use one machine for BitTorrent, you can simply share your dropbox watch directory with all of them.<br/><h3>The way computers should behave - the world according to Anna</h3><br/>User interface design is a complicated thing, and a lot of research has gone into it. What a lot of UI discussions miss, though, is that everyone has different needs and preferences. The setup I have described here works the way I personally like best. It is transparent; that is, it gets out of your way and just does what it is supposed to do, with no fuss. It is powerful and flexible. For a Linux power user who prefers to use the command line where she can, it is hard to imagine a better BitTorrent solution.