sudo apt-get install transmission-daemon
sudo mv /etc/dbus-1/system.d/Upstart.conf /etc/dbus-1/system.d/Upstart.conf.save
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> <busconfig> <!-- Only the root user can own the Upstart name --> <policy user="root"> <allow own="com.ubuntu.Upstart" /> </policy> <!-- Allow any user to invoke all of the methods on Upstart, its jobs or their instances, and to get and set properties - since Upstart isolates commands by user. --> <policy context="default"> <allow send_destination="com.ubuntu.Upstart" send_interface="org.freedesktop.DBus.Introspectable" /> <allow send_destination="com.ubuntu.Upstart" send_interface="org.freedesktop.DBus.Properties" /> <allow send_destination="com.ubuntu.Upstart" send_interface="com.ubuntu.Upstart0_6" /> <allow send_destination="com.ubuntu.Upstart" send_interface="com.ubuntu.Upstart0_6.Job" /> <allow send_destination="com.ubuntu.Upstart" send_interface="com.ubuntu.Upstart0_6.Instance" /> </policy> </busconfig>
sudo sh -c 'echo "manual" > /etc/init/transmission-daemon.override' sudo service transmission-daemon stop
mkdir $HOME/.init cat <<End-of-list > $HOME/.init/transmissiond-$USER.conf start on $USER-logged-in stop on runlevel [!2345] kill timeout 30 respawn setuid $USER env HOME=$HOME pre-start script # stop job from continuing if no config file found for daemon [ ! -f \$HOME/.transmissiond/transmission-daemon ] && { stop; exit 0; } # source the config file . \$HOME/.transmissiond/transmission-daemon # stop job from continuing if admin has not enabled service in # config file. [ "\$ENABLE_DAEMON" != 0 ] || { stop; exit 0; } end script script . \$HOME/.transmissiond/transmission-daemon exec /usr/bin/transmission-daemon -f \$OPTIONS end script End-of-list
~/.init/transmissiond-$USER.conf
with the necessary settings for the user daemon."start on $USER-logged-in"
can be replaced by "start on runlevel [2345]"
. In this case, however, Job does not need to be made custom, but can be placed in / etc / init / cat <<End-of-text > $HOME/.transmissiond/transmission-daemon ENABLE_DAEMON=1 CONFIG_DIR="$HOME/.transmissiond" OPTIONS="--config-dir \$CONFIG_DIR" End-of-text
pass="*****"
with your password. After the first launch, the transmission itself will hide the password with a hash - it does not store it in the clear. uid=`id -u` pass="*****" # cat <<End-of-list > $HOME/.transmissiond/settings.json { "alt-speed-down": 100, "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": 100, "bind-address-ipv4": "0.0.0.0", "bind-address-ipv6": "::", "blocklist-enabled": false, "blocklist-url": "http://www.example.com/blocklist", "cache-size-mb": 32, "dht-enabled": true, "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-enabled": true, "lpd-enabled": false, "max-peers-global": 200, "message-level": 2, "peer-congestion-algorithm": "", "peer-limit-global": 240, "peer-limit-per-torrent": 60, "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": true, "preallocation": 1, "prefetch-enabled": 1, "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-url": "/transmission/", "rpc-whitelist": "127.0.0.1", "rpc-whitelist-enabled": false, "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": 256, "speed-limit-down-enabled": false, "speed-limit-up": 256, "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, "download-dir": "$HOME/downloads", "incomplete-dir": "$HOME/downloads/incomplete", "peer-port": $((51413 + $uid - 1000)), "rpc-username": "$USER", "rpc-password": "$pass", "rpc-port": $((9091 + $uid - 1000)) } End-of-list
rpc-port = 9091 + $uid - 1000
Thus, a user with uid 1000 can access the web interface via server:9091
server:9091
, and the user with uid 1010 - by server:9101
server:9101
. peer-port is calculated similarly. echo "# start user specific daemons" >> "$HOME/.bashrc" echo "initctl emit $USER-logged-in" >> "$HOME/.bashrc"
mv "$HOME/.ecryptfs/auto-umount" "$HOME/.ecryptfs/_auto-umount"
Source: https://habr.com/ru/post/168767/
All Articles