Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

So I've set up transmission (the torrent app) to run a script on my torrent to automagically move my torrents and create symlinks to them. This is the script:


curl -d "email=email.address@gmail.com" \
-d "&notification[from_screen_name]=$TR_TORRENT_NAME" \
-d "&notification[message]=Torrent has finished downloading." \


echo -e "checked $tid - $name - $hash \n" >> /home/wouter/Apps/transmission/logfile

antwoord=$(php /home/wouter/Apps/transmission/determineaction.php $tid $hash 2> /dev/null);

echo $antwoord >> /home/wouter/Apps/transmission/logfile


echo -e "actie $actie - btnid $torrentid \n" >> /home/wouter/Apps/transmission/logfile

if [ $actie != 0 ]; then

    antwoord=$(php /home/wouter/Apps/transmission/returnfolder.php $torrentid 2> /dev/null);

    echo -e "serie $serie - seizoen $seizoen \n" >> /home/wouter/Apps/transmission/logfile  

    mkdir -p "/mnt/hdd3/Series/$serie/Season $seizoen"

    if [ $actie = 2 ]; then

        transmission-remote -t$tid --auth=wouter:neirod --move "/mnt/hdd3/Torrents/Broadcasthenet/Downloads"


    ext=$(echo $name | tail -c 5)
    linknaam=$(php /home/wouter/Apps/transmission/returnname.php $torrentid 2> /dev/null)

    echo -e "extensie $ext - linknaam $linknaam \n" >> /home/wouter/Apps/transmission/logfile

    if [ $ext = ".mkv" ]; then

        ln -s "../../../Torrents/Broadcasthenet/Downloads/$name" "/mnt/hdd3/Series/$serie/Season $seizoen/$linknaam" 2> /home/wouter/Apps/transmission/error


        ln -s "../../../Torrents/Broadcasthenet/Downloads/$name/*.mkv" "/mnt/hdd3/Series/$serie/Season $seizoen/$linknaam"



As you can see I've built in some logs to check where things go wrong. Everything goes well until the creation of the symbolic link. There the code spawns this error

ln: accessing `/mnt/hdd3/Series/Revenge/Season 2/Revenge - S02E09 - Revelations.mkv': Permission denied

I think transmission executes the script as user 'debian-transmission', so I've tried to execute it with this user. No errors.

I tried giving 777 permissions to the destination folder. This doesn't solve anything.

Why do I get a 'permission denied' and how can I solve it?

share|improve this question
What is hdd3 file system? –  ubuntufan Jan 4 '13 at 15:02
Please post the output of ls -ld "/mnt/hdd3/Series/Revenge/Season 2/", ls -l "/mnt/hdd3/Series/Revenge/Season 2/", and ls -ld ../../../Torrents/Broadcasthenet/Downloads/*. –  Flimm Jan 4 '13 at 15:07
try echo $(whoami) > /tmp/who to know which user run script –  ubuntufan Jan 4 '13 at 15:18
The hdd3 file system is ect4. The output of your commands is in that order: drwxrwxrw- 2 plex familie 4096 jan 4 15:23 /mnt/hdd3/Series//Revenge//Season 2/ –  vixducis Jan 4 '13 at 19:03
lrwxrwxrwx 1 plex familie 92 jan 2 15:23 Revenge - S02E01 - Destiny.mkv -> ../../../Torrents/Broadcasthenet/Downloads/Revenge.S02E01.1080p.WEB-DL.DD5.1.H.2‌​64-KiNGS.mkv lrwxrwxrwx 1 debian-transmission debian-transmission 92 jan 4 14:18 Revenge - S02E06 - Illusion.mkv -> ../../../Torrents/Broadcasthenet/Downloads/Revenge.S02E06.1080p.WEB-DL.DD5.1.H.2‌​64-KiNGS.mkv lrwxrwxrwx 1 debian-transmission debian-transmission 92 jan 4 14:46 Revenge - S02E07 - Penance.mkv -> ../../../Torrents/Broadcasthenet/Downloads/Revenge.S02E07.1080p.WEB-DL.DD5.1.H.2‌​64-KiNGS.mkv –  vixducis Jan 4 '13 at 19:10
show 3 more comments

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer


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

Browse other questions tagged or ask your own question.