i finally got around to setting up rtorrent today on my fileserver, and i'm loving it. i've got it set right now so that the watched directory that i download .torrents to is mounted on my desktop machine as an nfs share, but i'm having some problems with permissions. if i drag a .torrent into the folder from the desktop, all is good. but if i tell firefox to handle .torrents with a script that moves them automatically to the watched folder, they end up with no owner and so rtorrent doesn't have permissions to open them. how can i set the torrents i copy in to be owned by me? relevant line of /etc/exports on fileserver Code: /home/kyle/downloads 192.168.0.0/16(rw) relevant line of /etc/fstab on local Code: filserver:/home/kyle/downloads /home/kyle/downloads nfs user 0 0 script that firefox handles .torrents with Code: #!/bin/bash mv $1 /home/kyle/downloads/.watched/ any suggestions? edit: if i run the script from the commandline the permissions are still ok, so it has to be something to do with how firefox calls the script. or maybe it's that the .torrent that firefox downloads never gets an owner.
I think chown is the command you are looking for. Code: #!/bin/bash chown <username> $1 mv $1 /home/kyle/downloads/.watched/ I think this will work but if not, just post back and I'll try to think of something else
no, that didn't work. Code: chown kyle $1 2> ~/torrentmover.log should output stderr to a file right? because even though it didn't work, torrentmover.log is empty.
chown only works as root... That's why it probably didn't work. Also, I don't think it returns anything. A couple of questions: What does Code: ls -al /home/kyle/downloads on both system return? When Firefox is running, what does Code: ps aux| grep firefox return? You can try to set the .torrent directory so that it's group readable and add rtorrent (user) to the group kyle is in?
My guess would be the file isn't actually written by firefox to your desktop, it only ever writes it to the server so when you do the mv it hasn't got any permissions yet. Have you tried the chown command after the mv? That way you are definitely chown-ing the file that has been written. You may need to chmod it as well, I guess 755 should do the trick.
ls -al /home/kyle/downloads on fileserver gives (block and date omitted) Code: drwxrwxrwx 2 kyle kyle . drwxrwxrwx 16 kyle kyle .. -rw-r--r-- 1 nobody nobody all.torrents desktop is the same thing but nobody nobody is replaced with nouser nogroup. (different versions of ls?) ps aux Code: kyle 11864 1.9 5.4 652496 ? Sl 01:27 11:43 /usr/lib/firefox-3.0.6/firefox trigger, as glider says chown won't work because it's not root.
okay, new problem. when i try to add a torrent with spaces in the filename, mv takes the spaces to mean they're separating arguments. is there an easy way to replace every ' ' in $1 with '\ '?
I don't know if this will work, but can't you place the filename inside ""? So it looks something like this: mv "path/to/file name" "path/to/file name"