Add a New Torrent to a Remote Running qBittorrent

This post is to help to add a new torrent to a already running qBittorrent instance on an already running remote XServer

You may have experienced when trying to add a torrent on a remote machine from command line interface (CLI), the following error occured:

~ $ qbittorrent TORRENT-URL
qbittorrent: cannot connect to X server

The problem was that the SSH was not able to forward the related connection to the XServer from the SSH CLI.

All right, I know there exist several better ways how to achieve the same trick. However, all of them assume a prior appropriate setup of the remote server. For example, the remote access tools are:

  • NX (encryption, compression, etc.)
  • VNC (it’s unencrypted and needs to be combined with SSH!)
  • RDP, KVM, and many others…

You can also access the qBittorrent web interface remotely. Unfortunately, if you did not check the proper option before it had started, you can only modify its text configuration file. However, you are not able to restart qBittorrent as you still do not have access to the display on the XServer (you can kill it but not start it).

The Other Way

Assuming there exists a running XServer, an SSH daemon, and a qBittorrent on the remote machine, and you have the root access to the system files, you can go forward with:

  • SSH daemon configuration modification
  • Local SSH configuration modification
  • Remote access via SSH with X11Forwarding enabled
  • Add the torrent to a running instance of qBittorrent

SSH daemon configuration modification

On the remote server, edit /etc/ssh/sshd_config and add:

# Allow X11 forwarding
AllowTcpForwarding yes
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes

Local SSH configuration modification

On you local machine, edit /etc/ssh/ssh_config:

# X11 forwarding
ForwardX11 yes
ForwardX11Trusted yes

Remote access via SSH with X11Forwarding enabled

Log onto the remote machine with X11Forwarding enabled via SSH:


Add the torrent to a running instance of qBittorrent

qbittorrent TORRENT-URL

That’s it, the torrent is added into your running qBittorrent instance. You can verify the same checking the download directory, that a new directory of the new torrent was added.

This entry was posted in Apple, Linux, Security, Server and tagged , , , , , , , . Bookmark the permalink.