transmission

One note about installing transmission; make sure to stop the service before editing the config file. It will replace your settings with it's running settings when it exits, otherwise.

sudo apt install transmission-daemon
sudo service transmission-daemon stop
sudo vim /etc/transmission-daemon/settings.json

"dht-enabled": false,
"rpc-whitelist": "127.0.0.1,192.168.*.*",
"peer-limit-global": 960,
"peer-limit-per-torrent": 288,
"preallocation": 2,
"rename-partial-files": false,

  "watch-dir": "xxxxx",
   "watch-dir-enabled": true

# Legacy setting not needed anymore
"max-peers-global": 960,

Most systems will require adjustment of the iptables firewall, should you be using such, for both the web admin port and the torrent traffic port. If you're using something other than the standard port, adjust to suit. If you're using random ports, you may want to open a range.

# The web admin port is tcp 9091 and peer traffic is 51413 tcp/udp by default
sudo iptables -A INPUT -p tcp -s 192.168.1.1/24 --dport 9091 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 51413 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -A INPUT -p udp --dport 51413 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT

Should you have a router and NAT tranmission will use upnp to forward the appropriate ports. You can also check out upnpc for manipulating that device manually or via script.

If you're using a VPN such as openvpn you may want to restrict traffic to that connection. You can manipulate transmission to ensure that and enable port forwarding while you're at it. Tie this into the daemon start process or simply execute it when you're ready to use transmission.

# TODO - detect if we failed and put the old config file back
#       - Don't proceed unless we have both IP and PORT

# These are not your normal credentials and are specific to the openvpn service.
# Get these and the client ID from their website support section
USER=xxxx
PASS=xxxxx
CLIENT_ID=xxxxx

IP=$(ip -o -4 addr list tun0 | awk '{print $4}')
PORT=$(curl -d "user=$USER&pass=$PASS&client_id=$CLIENT_ID&local_ip=$IP" https://www.privateinternetaccess.com/vpninfo/port_forward_assignment | grep -o '[0-9]\+')

echo $IP $PORT

sudo service transmission-daemon stop

sudo sed -i "s/bind-address-ipv4.*/bind-address-ipv4\": \"$IP\",/" /etc/transmission-daemon/settings.json
sudo sed -i "s/peer-port\".*/peer-port\": $PORT, /" /etc/transmission-daemon/settings.json

sudo iptables -A INPUT -i tun0 -p tcp -m tcp --dport $PORT -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -A INPUT -i tun0 -p udp -m udp --dport $PORT -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT

sudo service transmission-daemon start



Comments