File and Folder Permissions

As I get my Ubuntu system running the way I like I find I am copying files over from my old windows partitions (mp3's, documents, pictures, etc.). I was looking at the permissions of my pictures - they were set to 777. I didn't understand why. I think it has to do with the fact that I copied them from a windows ntfs partition. I can understand if it were set to 666, but having an the executable bit set really throw me. I wanted to change my pictures to permissions of 644. I tried running the chmod command in my home folder on my pictures.

    chmod -R 644 *

This worked, except the directories were set 644 as well. They would not open in nautilus. I found out that the permissions of typical directories should be set to 755. This is fine. The only problem is I can't run the chmod command as it will change the picture permissions as well.

It turns out you need to run something like this:

    #change the file permissions in my pictures directory:
    find ~/pictures/ -type f -print0 | xargs -0 chmod 644

    #change the sub-directory permissions in my pictures directory:
    find ~/pictures/ -type d -print0 | xargs -0 chmod 755

Troy Williams

My name is Troy Williams and I am a professional mining engineer and programmer writing software for the mining industry.