1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Transmission download file permission

Discussion in 'Web and Network Services' started by Dead_Lemon, Apr 27, 2012.

  1. Dead_Lemon

    Dead_Lemon New Member

    Messages:
    16
    Likes Received:
    0
    Hey all,

    I'm rather new to Freebsd FreeBSD, and the *nix world in general. I've built myself a file/download server and all has been ok for now, but I'm confused with the way Transmission is creating folder and privileges. It seems that when I set a file to download, the folder it creates, sets its permissions as root, so I cannot delete the file over my network without having to SSH into the box and using chmod 777 on the folder.

    For the shared folder I'm using Samba (which I'm still trying to figure out for the most part) shares for my windows network, using a user name, NFS, as the login account to the share (I used a tutorial on ZFSguru, and used there same settings).

    Is there a way to change this? A setting in Transmission that changes what account it uses to create the new directories?
     
  2. sk8harddiefast

    sk8harddiefast Member

    Messages:
    2,011
    Likes Received:
    7
    Install sudo. Create a user. Edit the sudoers file adding the user to it. Install Transmission as the user using sudo. Do not run FreeBSD as root. Always create a user and use the sudo command. Working as root all config files go in /root and not in /home/user. They have different permissions.
     
  3. Dead_Lemon

    Dead_Lemon New Member

    Messages:
    16
    Likes Received:
    0
    Awesome, thanks, so I must uninstall transmission first, then install it onto my other account?
     
  4. sk8harddiefast

    sk8harddiefast Member

    Messages:
    2,011
    Likes Received:
    7
    Yep. Uninstall it (as root or as user using sudo) and just as user run: sudo make install clean into Transmission port.
     
  5. Dead_Lemon

    Dead_Lemon New Member

    Messages:
    16
    Likes Received:
    0
    Ok, reinstalled it under a non root account

    But I still can't delete the folders Transmission makes, says I now require permission from Unix user/transmission. I'm confused now how I would set my network login account to have equal permissions as transmission.
     
  6. SirDice

    SirDice Moderator Staff Member Moderator

    Messages:
    17,418
    Likes Received:
    14
    Simple solution, no sudo or anything else needed. Set a download directory in transmission. I'm using /storage/media/transmission/Downloads/ but you can use any directory you want. The important things are its permissions.

    Set it to:
    Code:
    root@molly:~#ls -ld /storage/media/transmission/Downloads/
    drwxrwxr-x  46 transmission  transmission  476 Apr 29 20:49 /storage/media/transmission/Downloads/
    
    Note the write permissions on the group transmission. Now add your user to that group:
    pw groupmod transmission -m dice

    Log off and log back in. The user dice now has write access to the transmission download directory. And thus can delete files there.
     
  7. Dead_Lemon

    Dead_Lemon New Member

    Messages:
    16
    Likes Received:
    0
    I'm still not winning

    Code:
    [root@server /usr/home/admin]# ls -ld /tank/download/torrents/test              
    drwxr-xr-x  3 transmission  admin  3 May  1 18:50 /tank/download/torrents/test
    
     
  8. SirDice

    SirDice Moderator Staff Member Moderator

    Messages:
    17,418
    Likes Received:
    14
    Ah, forgot to set the umask :e

    Open settings.json when transmission is stopped. Look for:
    Code:
        "umask": 18,
    
    Change that to 2.
     
  9. Dead_Lemon

    Dead_Lemon New Member

    Messages:
    16
    Likes Received:
    0
    Still not working, but I think I know why. I used this tutorial when setting it up initially http://pynej.blogspot.com/2010/02/set-up-transmission-deamon-bittorrent.html. I now understand this article way better now, not like when I first installed it, blindly tapping away.

    In the tutorial he uses sudo pw usermod USERNAME -G transmission and I used that, not originally knowing exactly what it did and I just noticed the one use comment
    In the original command I used Admin as my USERNAME (admin is my general purpose local machine account) sudo pw usermod Admin -G transmission

    I noticed today that in your example
    Code:
    root@molly:~#ls -ld /storage/media/transmission/Downloads/
    drwxrwxr-x  46 transmission  transmission  476 Apr 29 20:49 /storage/media/transmission/Downloads/
    you have transmission:transmission as folder permissions whereas mine is transmission:admin
    Code:
    [root@server /usr/home/admin]# ls -ld /tank/download/torrents/test              
    drwxr-xr-x  3 transmission  admin  3 May  1 18:50 /tank/download/torrents/test
    
    Not sure how to fix this, or even view all my different groups (also, nfs, is the group I'm looking to give permissions to have read write access, as it is my samba account).
     
  10. SirDice

    SirDice Moderator Staff Member Moderator

    Messages:
    17,418
    Likes Received:
    14
    Note that setting the umask in settings.json only works for new files that are downloaded. Previously downloaded files aren't changed.

    chown(8) or chgrp(1) are the commands you're looking for. To figure out which groups are attached to your user account use id(1).

    Code:
    dice@molly:~%id -a
    uid=1001(dice) gid=1001(dice) groups=1001(dice),500(admin),921(transmission)
    
    chown(8) or chgrp(1):
    # chown -R transmission:transmission /tank/download/torrents/
    # chgrp -R transmission /tank/download/torrents/

    The -R will make sure all files and directories are set recursively.
     
  11. Dead_Lemon

    Dead_Lemon New Member

    Messages:
    16
    Likes Received:
    0
    It's working now. It must have just been the folder permissions then.

    I found that after changing the permissions that I could immediately delete those folders I downloaded with "umask": 2 adjustment, what exactly does that do?

    Thanks very much for all your help
     
  12. SirDice

    SirDice Moderator Staff Member Moderator

    Messages:
    17,418
    Likes Received:
    14
    Think of umask(1) as a filter. Files are created with 666 permissions and the umask filters some of those bits out. A umask of 2 will make files 664, which is read/write for the owner and group and only read for everyone else.
     
  13. Dead_Lemon

    Dead_Lemon New Member

    Messages:
    16
    Likes Received:
    0
    Awesome, thanks so much for all the help.