3

What's the ideal chmod setting for a user uploads folder? Needs to be able to have files written to it in PHP, and then have the images pulled down remotely for use in the actual app?

Obviously 777 isn't ideal, which is what I have it at now!

Walker
  • 128,495
  • 27
  • 68
  • 94
  • Seems to be a duplicate question of http://stackoverflow.com/questions/828172/how-do-i-secure-a-web-servers-image-upload-directory – adorablepuppy Apr 21 '11 at 05:24

1 Answers1

4

4664 is pretty common,

Everyone can read, group and owner can write, and new directories inherit the permissions and ownership.

to clarify, the leading 4 specifies both setgid and sticky bit set, meaning that directories created underneath this directory will inherit the group ownership and sticky bit (effectively recursively).

It means that the tree you create underneath this directory will continue to function the same way.

richo
  • 8,717
  • 3
  • 29
  • 47
  • 1
    @alex I was curious too. Found this http://www.javascriptkit.com/script/script2/chmodcal2.shtml 1st digit is for setting if a superuser can setuid/setgid/stickybit. The value of 4 means bot setgid and stickybit are selected. I'm not big on Linux so I have no idea what those values do. I think it's safe to omit the 1st digit if you don't specifically need it. – Lienau Apr 21 '11 at 05:43