Take the 2-minute tour ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

I have Raspberry Pi running RaspBMC with a WD MyBook connected using USB. The drive is automatically mounted to /media/My Book. I have created a folder /media/My Book/downloads and I have set Trasmission's download directory to be /media/My Book/downloads.

When I try to download a file, Transmission says

Error: Permission denied (/media/My Book/downloads/The.Simpsons.S24E09.720p.HDTV.X264-DIMENSION [PublicHD]/The.Simpsons.S24E09.720p.HD

ls -la gives me

drwx------ 1 pi       0 Dec 15 16:24 downloads 

So I guess the problem is that transmission runs under different user than pi and cannot write to the folder. However when I execute

chmod 777 downloads -R

the operations succeeds without any error but the permissions do not change, they stay 700 just for the owner.

What am I doing wrong and how can I enabled Transmission to write to that directory?

share|improve this question

8 Answers 8

up vote 7 down vote accepted

The problem was the way the USB disk was automonted. I mounted it manualy with mount -t ntfs-3g and it started working.

share|improve this answer
    
Same happened to me. With the HDD auto-mounted all the permissions were set to 0700, but mounting it with sudo mount -t ntfs-3g -o uid=pi,gid=pi /dev/sda1 /media/HDD/ they are 0777 and transmission works perfectly, really weird. –  Puigcerber Sep 29 at 18:31

I'm no linux expert, but you could try this, might work. Most of this is info came from http://www.superfecta.ca/?p=44

sudo service transmission-daemon stop
sudo nano /etc/init.d/transmission-daemon

change

USER=debian-transmission

to

USER=root
ctrl-x
Y
# hit enter to overwrite
sudo service transmission-daemon start

I know running as root is a big linux no no (not sure if that counts as running in root) but it worked for me so I'm fine with it. You could try USER=pi instead but I got no love there, so I stuck with root

share|improve this answer
1  
Of course running as root works, it's just a security risk. –  Blaisorblade Mar 2 '13 at 1:47
    
Just something to add: Linux uses /etc/fstab file to set up mount points and permissions/ownership of the drive. So, you have three choices, run transmission as root, run transmission as the owner of the folder where the drive resides (ls -l will tell you who owns it), or modify the /etc/fstab file to show a different owner (i.e. debian-transmission). –  Terry Nov 16 '13 at 6:56

I believe your problem is your USB stick is formatted as NFTS or FAT, filesystems that do not support the per-user/group permissions. The solution is to reformat as ext4. If you do that, you will also have much less lag if you are using your Pi as a media center. The drivers for the Pi are much faster when you use ext4.

share|improve this answer

Once you change the transmission-daemon user to root the permissions problem is gone with either a usb or smb share.

sudo nano /etc/init.d/transmission-daemon

then change the user line to:

USER=root

share|improve this answer
3  
That's a security risk. –  Blaisorblade Mar 2 '13 at 1:47
sudo chown debian-transmission /downloads

where /downloads is the directory you want your downloads to be in (or mount location).

this is safer than using root.

this gives the 'user' known as 'debian-transmission' rights to the folder

share|improve this answer

The problem relates to FAT not recognising multiple users.

If you use a line in your fstab file such as /dev/[your dev] /mnt/usb1 vfat defaults,uid=65534,gid=65534,dmask=000,fmask=111 0 0

it should mount your filesystem with folders 777 and files as 666 owned by "nobody" belonging to "nogroup"

you will need to remount (or reboot) for the changes to be seen.

share|improve this answer

Finally found a working solution.

I turned of autosharing removable devices in XBIAN settings and added the disk to shares.conf by hand

[mybook]
    path = /media/mybook
    guest ok = yes
    read only = no
    browseable = yes
    writeable = yes
    force user = xbian

Just adding it to shares.conf is not enough, autosharing must be turned off.

share|improve this answer

chmod 777 should give every user all permissions to a file or directory. If that doesn't work, it's likely that the user that execute that chmod command does not own the directory or file. For example, if root owns /media/My Book/ and the pi user will not be able to change the permissions of that file. The three numbers you pass to the chmod command affect the owner, the group, and everybody else, in that order. Thus the most common settings for a directory are "chmod 755 somedirectory". That mean the owner can read, write and change into the directory, but group and everyone else can only read files and change into the directory.

share|improve this answer
1  
This answer really doesn't answer the question. The asker has already tried chmodding the file and it didn't work. –  bearbin Feb 9 '13 at 8:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.