linux, mikrotik, macosx

This article explains how to install, configure, and run Transmission on a headless Ubuntu Lucid Lynx (10.04) server. Transmission, specifically transmission-daemon, is a BitTorrent client that can be accessed via a web browser and other front-ends, including a desktop app called trasmission-remote-gui and Android apps, including Transdroid (my favorite) and TorrentFu.

Transmission’s daemon is a good choice over rtorrent, an excellent ncurses client that I used to prefer, because Transmission is simpler to configure, and requires no other software to be installed for accessibility via a web browser or external client.

Installation

First, install the Transmission daemon using apt-get. This part is simple.

$ sudo apt-get install transmission-daemon

This installs the app and starts the daemon. The daemon runs under the user “debian-transmission”, which belongs to a group of the same name.

Configuration

Configuring Transmission is a little tricky, due to the placement of the configuration file (out of the box, the daemon doesn’t read /etc/transmission-daemon/settings.json, as you would expect), and due to the service’s method of saving (overwriting) its configuration file on exit. Restarting the service, if it is already running, will result in it saving the configuration file, and overwriting any changes you might have made to it. Instead of restarting the service after editing the configuration file, you should reload the service. The following code sends a SIGHUP signal to transmission-daemon, which causes it to reload its configuration file.

$ sudo service transmission-daemon reload

Edit the settings file using your favorite text editor. Note that the default location is /var/lib/transmission-daemon/info/settings.json.

$ sudo vi /var/lib/transmission-daemon/info/settings.json

Here is my settings.json file. I have almost all the options set. I recommend that you use my file as a starting point. You have to edit the rpc-whitelist setting to connect to the server from anything other than the local host. You should also edit the paths (download-dir, watch-dir, incomplete-dir) as you see fit.

It is (for the most part) safe to enter a plaintext password in this file. If you do so, when transmission-daemon closes, and it rewrites its settings file, the password will be saved in a SHA1 encrypted format. Just restart the service after completing these instructions, and your password will be encrypted.

I encountered difficulties with file permissions when I had Transmission save downloads within the /var/lib/transmission-daemon/. Therefore, I changed Transmissions setting to download to a folder within my home directory. To ensure that both I and the debian-transmission user had read/write permissions, I added my account to the debian-transmission group (which is created when you install transmission), and I changed the group ownership of my torrent download directory to debian-transmission. Doing so grants the debian-transmission group read/write access to that folder, preserves read/write/execute access for my account, and prevents access to all others.

I also changed the “umask” setting from the default of 18 to 2. That means transmission-daemon will create files with read/write permissions set at both the user and group level.

After saving any changes, tell the daemon to reload its configuration file.

$ sudo service transmission-daemon reload

That finishes configuration. Note that you will likely have to set up port forwarding on your router to access the web app from outside your network, and to seed properly.

Web Access

To access the server, point your web browser to

http://your.server.ip.address:9091.

(9091 is the default port, which can be changed, under “rpc-port”, in the settings file.) The web interface is pretty simple. Note that you can adjust some settings, such as transfer speed and download directory, by clicking the gear on the lower right of the page.