So I'm trying to setup a display using this shifting tiles animation. I'm not putting it on a website, it's just going to be used on the local raspberry pi to display on a TV (http://localhost/) so I'm not worried about security. I've got it working by adding a few photos into the /var/www/html/ directory. But I'd like to be able to fill up a large flashdrive with 1000's of photos and randomly pull from that. My problem is I can't seem to get the permissions to do so. Are there any simple ways to read files from a usb drive?

  • what happens if you add a link to the USB drive into the /var/www/html/ directory?
    – jsotola
    Dec 16, 2019 at 21:00
  • @Michael, to add a link, do something like this: ln path/to/target linkName. You could do this for each picture, or add a link directly to the folder containing all the pictures.
    – user96931
    Dec 16, 2019 at 21:06
  • well I think my issues are with permissions. Won't the link not work if www-data doesn't have permission to read/write on the USB?
    – Michael
    Dec 17, 2019 at 23:18

1 Answer 1


Try 'sudo' to copy or link the files as 'root' to bypass permissions.


sudo ln -s /[flashdrive-path]/*.jpg /var/www/html/

A neater way may be with relative path links, e.g. something like

sudo sh -c 'cd /var/www/html; ln -s /[flashdrive-path]/*.jpg .'

You could then change ownership to www-data using 'sudo chown on the symlinks'

If you still have permission problems, and you're not worried about security, you could make the image files and sub-directories readable by all, e.g.

chmod -R a+r /[flashdrive-path]/*

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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