6

I would like to be able to move files downloaded by transmission in the name of my primary user.

I added this user to the group debian-transmission, but it is not enough, only the owner has the write permission on the downloaded files.

So I see some possibilities:

  • changing the user of transmission, but that does not seem to be a good practice.
  • set an option in transmission to let it write a file with write permissions for the group, but I do not know if it is possible.

So what is your advice to lead to a good solution?

Gaël Barbin
  • 327
  • 1
  • 4
  • 18

3 Answers3

13

The solution proposed by @sverker is good, but I suggest you change the configuration of transmission so that it changes the umask with which are written the downloaded files. The configuration is stored in

~/.config/transmission/settings.json

Find and change the "umask" value. Note that the json format uses decimal notation, so take a look at the table and find a value for the new umask (ex: 22)

Umask   Created Files       Created Directories
-------------------------------------------------------------
000     666 (rw-rw-rw-)     777     (rwxrwxrwx)
002     664 (rw-rw-r--)     775     (rwxrwxr-x)
022     644 (rw-r--r--)     755     (rwxr-xr-x)
027     640 (rw-r-----)     750     (rwxr-x---)
077     600 (rw-------)     700     (rwx------)
277     400 (r--------)     500     (r-x------)

then in a terminal:

#echo $((8#022)) 
18

Finally change the umask value to 18

LilloX
  • 1,997
  • 12
  • 16
1

Transmission, at least as a daemon, has the option to run a script on completion of a torrent. You should be able to tell this script to chmod to 664 upon completion. From there, the files should be accessible, and writable from your main user. You could make a script that contains these lines:

#!/usr/bin/env bash    
chmod -R 664 ${TR_TORRENT_DIR}
exit 0

You then make that script executable, and place it somewhere where transmission-daemon can access it, like /usr/local/bin or something.

Then you tell transmission-daemon to run the script upon torrent completion. You can either do this by GUI, or to have this line in your /etc/transmission-daemon/settings.json file:

"script-torrent-done-filename": "/usr/local/bin/your-script.sh", 

And that should be that. The concept of the script-torrent-done is rather powerful, I use it to sort torrents into movies/music/etc according to its content, but that's a rather longer script :)

0

You should read up on ACL, it allows you to add additional permissions, like add permissions for your main user.

for e.g sudo setfacl -d -R u:gael:rw /home/transmission allows your user to read and write to that directory. -d is default which means files created in that directory will have those new permissions. Usually you use -m instead of -d. Run with -m to apply to existing files.

You could make a script to run the setfacl command on completion to ensure all files are correct, As Sverker suggested;