How to Remotely Control KTorrent

KTorrent is KDE’s BitTorrent client that has a uniquely useful plugin allowing users to connect and add torrents remotely using a web browser. In a previous post, we gave you a taste of what Ktorrent can do. Today, you will learn how to start Ktorrent remotely, add torrents from URLs or file uploads, and make small settings changes to currently downloading files.

Installation and Setup

Most Linux distributions that ship KDE as an option or as the default desktop also distribute packages for KTorrent. For example, to install KTorrent on Kubuntu or other Ubuntu variants, just use the graphical installation program or open a terminal and run:

sudo apt-get install ktorrent

Once installed, start KTorrent on the machine where you want it to run. You will need to configure it before you start using it remotely. First, in the main menu, click “Settings” and “Configure KTorrent”.

KTorrent Settings Window

Set the default save location to the place where you want your torrent files to be saved. The web interface will not allow you to access this setting remotely. Click “OK” to finish the configuration.

KTorrent plugin settings

Next, click the “Plugins” tab on the left. Check the “Web Interface” box to enable remote management. Now, go back into “Settings” -> “Configure KTorrent” and click the “Web Interface” tab. You should probably use a login and password, but it is optional. Make sure the default web server port is not used by another application. If it is, change it to something else.

KTorrent Web Interface Settings

Click “OK”, and you should now have a KTorrent web server running on the computer. To verify that it is running, open your web browser and navigate to http://localhost:8080/. Replace 8080 with the port number you used.

Starting KTorrent Remotely

If you are not completely obsessed with convenience, you can always start KTorrent directly from the host machine and keep it running in the system tray. If, however, you need to start it remotely, you can use SSH.

Before you go any further, you need to make sure your computer’s firewall will permit the port you will use for remote connection.

Next, login to the remote machine via SSH:

ssh -l username ipaddress

Replace “username” with the computer’s currently logged-in username and “ipaddress” with the local IP of the computer. You may also be able to use the computer’s host name. It will prompt you for a password and should give you access to the remote command line.

Finally, start ktorrent so that it opens on the user’s current X display rather than yours:

ktorrent --display :0 &

If the user is not logged in on :0 X display, change it to the appropriate number. If you are unsure that it worked, you can check to see if it is running:

ps aux | grep ktorrent

You now have the option of adding torrent URLs directly through SSH:

ktorrent /path/to/torrent/file/filename.torrent --silent

Alternatively, you can exit SSH and access KTorrent from the web interface.

Web Interface

The KTorrent web interface is very basic but gets the job done. First, open your web browser, go to the IP address or hostname of the computer running KTorrent, and add the port number to the end. For example:

KTorrent web interface

If it connects correctly, you will see the KTorrent header and login form. Enter the username and password you created during the initial setup. If did not make one, it should pass you straight through to the interface.

The first page you see will be the Torrents tab. To add a new torrent, click “Load Torrent”. There are two ways to load a torrent:

1) with the direct URL to a torrent file from a website or
2) from a downloaded file.

Once you have entered the URL or file, click “Upload Torrent”.

KTorrent web interface upload torrent

Click back on the Torrents tab to make any individual configuration changes to downloading or seeding torrents. The buttons to the left of each torrent allow you to start, stop, or remove them, and the page will continuously update to show you current download information.

For torrents with multiple files, the title will be displayed as a hyperlink. Click on it to configure individual files. Using the icons to the left of each file, you can set the download priority for each.

KTorrent web interface downloads

The third tab is “Settings”, but this only contains a fraction of the settings available in the actual KTorrent application. It allows you to configure upload/download speeds and also gives you some control over the web interface, such as automatic refresh.

When you are finished with your torrents, click “Logout”. Alternatively, if you are completely finished with KTorrent and all of your torrents are completed, you can click “Shutdown” to end the program completely.

Tavis J. Hampton

Tavis J. Hampton is a freelance writer from Indianapolis. He is an avid user of free and open source software and strongly believes that software and knowledge should be free and accessible to all people. He enjoys reading, writing, teaching, spending time with his family, and playing with gadgets.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox