Transmission

• 下载与配置

下载并打开配置文件

$ sudo apt-get update && sudo apt-get install transmission-daemon
$ sudo systemctl stop transmission-daemon  # 暂停运行
$ sudo nano /etc/transmission-daemon/settings.json

修改配置文件

# Transmission-daemon configuration file #
{
    "alt-speed-down": 50,
    "alt-speed-enabled": false,
    "alt-speed-time-begin": 540,
    "alt-speed-time-day": 127,
    "alt-speed-time-enabled": false,
    "alt-speed-time-end": 1020,
    "alt-speed-up": 50,
    "bind-address-ipv4": "0.0.0.0",
    "bind-address-ipv6": "::",
    "blocklist-enabled": false,
    "blocklist-url": "http://www.example.com/blocklist",
    "cache-size-mb": 4,
    "dht-enabled": true,
    "download-dir": "/var/lib/transmission-daemon/downloads",  # 选择文件存储路径
    "download-limit": 100,
    "download-limit-enabled": 0,
    "download-queue-enabled": true,
    "download-queue-size": 5,
    "encryption": 1,
    "idle-seeding-limit": 30,
    "idle-seeding-limit-enabled": false,
    "incomplete-dir": "/var/lib/transmission-daemon/Downloads",
    "incomplete-dir-enabled": false,
    "lpd-enabled": false,
    "max-peers-global": 200,
    "message-level": 1,
    "peer-congestion-algorithm": "",
    "peer-id-ttl-hours": 6,
    "peer-limit-global": 200,
    "peer-limit-per-torrent": 50,
    "peer-port": 51413,
    "peer-port-random-high": 65535,
    "peer-port-random-low": 49152,
    "peer-port-random-on-start": false,
    "peer-socket-tos": "default",
    "pex-enabled": true,
    "port-forwarding-enabled": false,
    "preallocation": 1,
    "prefetch-enabled": true,
    "queue-stalled-enabled": true,
    "queue-stalled-minutes": 30,
    "ratio-limit": 2,
    "ratio-limit-enabled": false,
    "rename-partial-files": true,
    "rpc-authentication-required": true,
    "rpc-bind-address": "0.0.0.0",
    "rpc-enabled": true,
    "rpc-host-whitelist": "",
    "rpc-host-whitelist-enabled": true,
    "rpc-password": "{51672671e9402abc55992da3ee7809f2c0662d10uLpcJwyX",  # 修改网络接口登录密码
    "rpc-port": 9091,
    "rpc-url": "/transmission/",
    "rpc-username": "transmission",  # 修改网络接口登录用户名
    "rpc-whitelist": "127.0.0.1,192.168.1.40",  # 添加client ip地址,这样client端也可以访问网络接口
    "rpc-whitelist-enabled": true,
    "scrape-paused-torrents-enabled": true,
    "script-torrent-done-enabled": false,
    "script-torrent-done-filename": "",
    "seed-queue-enabled": false,
    "seed-queue-size": 10,
    "speed-limit-down": 100,
    "speed-limit-down-enabled": false,
    "speed-limit-up": 100,
    "speed-limit-up-enabled": false,
    "start-added-torrents": true,
    "trash-original-torrent-files": false,
    "umask": 18,
    "upload-limit": 100,
    "upload-limit-enabled": 0,
    "upload-slots-per-torrent": 14,
    "utp-enabled": true
}

防火墙设置

$ sudo ufw allow 9091,51413/tcp
$ sudo systemctl start transmission-daemon

访问网络接口使用网址: http://192.168.1.39:9091/transmission ,将中间的ip换成服务器地址。

• Troubleshooting

如下载过程中遇到permission denied的问题,解决方法如下:

$ sudo usermod -a -G debian-transmission username
$ sudo chgrp debian-transmission /home/username/download_folder
$ sudo nano /etc/transmission-daemon/settings.json

"umask": 18 改成 "umask": 2 ,然后

$ sudo service transmission-daemon start

FTP设置

• 下载与配置

$ sudo apt install vsftpd
$ sudo mv /etc/vsftpd.conf /etc/vsftpd.conf_orig  # 备份
$ sudo nano /etc/vsftpd.conf

复制下面配置文件内容并粘贴

listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
pasv_enable=Yes
pasv_min_port=10000
pasv_max_port=10100
allow_writeable_chroot=YES

设置防火墙

$ sudo ufw allow from any to any port 20,21,10000:10100 proto tcp
$ sudo systemctl restart vsftpd

创建FTP用户

$ sudo useradd -m ftpuser
$ sudo passwd ftpuser

确保 /home/ftpuser/ 路径下有至少一个文件

References:

  1. https://linuxconfig.org/how-to-set-up-transmission-daemon-on-a-raspberry-pi-and-control-it-via-web-interface
  2. https://askubuntu.com/questions/221081/permission-denied-when-downloading-with-transmission-daemon
  3. https://linuxconfig.org/how-to-setup-and-use-ftp-server-in-ubuntu-linux