I put a blog on the web for a school project where pupils can post but one thing is not working properly: Photos are not being displayed because the rights of newly uploaded files are always automatically set to 600 by the server (the folder rights are set to 775). So I wrote the following cron jobs for the 3 folders concerned:
chmod 666 /www/aublg/blog/userfiles/images
chmod 666 /www/aublg/blog/userfiles/flash
chmod 666 /www/aublg/blog/userfiles/documents
However, nothing changed: neither the old nor any newly uploaded photos were displayed (not even in the preview mode of the blog). Do these jobs only refer to the folders but not to the files in them? What do I have to write/ add to set every newly uploaded file to 666 (immediately, if possible, so they will already be displayed in preview mode)? It would be great if someone could help me with the exact script. (Without the possibility of uploading photos, the blog would not be very interesting for kids.)
Thanks very much!
I agree with jim mcnamara findings. The original cron just changed the permissions of the directory but not the files within the directory.
The whole process can be one script called from cron. This untested example avoids expanding "*" to an unknown number of filenames, deals with filenames containing spaces, and will work for any number of files:
#!/bin/ksh
for DIR in "/www/aublg/blog/userfiles/images" \
"/www/aublg/blog/userfiles/flash" \
"/www/aublg/blog/userfiles/documents"
do
if [ -d "${DIR}" ]
then
cd "${DIR}"
find . -type f -print | while read FILENAME
do
chmod 666 "${FILENAME}"
done
else
echo "Directory missing: ${DIR}"
fi
done
Thank you both for your suggestions and your quick reply!
It's very strange: nothing shows any effect, although I make sure each time there are no misspellings or any other errors in the string. I tried everything I could think of: adding /, /*., even /$newfile (I saw that somewhere in the documentation of another blog), I copied methyl's script into the crontab file, set the .bash_history and .viminfo files to 777 (they had 600): nothing worked, the rights of the images in the file concerned stay unchanged (600), every newly uploaded image gets the same rights and still nothing is displayed. What could be the reason for this? Do you have any other suggestions?