1

When I upload new files to my CentOS server, with cPanel and CSF the files are all given 0777 permissions automatically.

How do I change this? I don't want all my files to have 0777 permissions by default.

womble
  • 95,029
  • 29
  • 173
  • 228
Anders
  • 207
  • 1
  • 2
  • 7

2 Answers2

2

Kudos for actually recognising that 0777 is a bad permission set... most people come here asking how to make all their files wide-open, not the other way around...

I don't have a specific answer for you (I don't use cpanel, thank $DEITY), but I don't think it's a stock configuration thing -- it smells like something's been modified behind the scenes. You don't specify the method by which you're uploading these files, but in general what you're looking for is a configuration option in whatever service you're using that is called something like "umask" -- this is the bit pattern that "masks out" permissions from newly created files. It's usually specified in octal, like the permissions bits themselves, and it's a set of bits that get removed from the standard permission set (0666) -- so a mask of 0022 means that new files will get 0644 (user-writable-only), and a mask 0002 means that new files will get 0664 (group-writable).

The only thing that is slightly odd is that all your files are getting +x applied, which isn't usual practice -- but it might be something in whatever service you're using that Does Things to the permission bits. There's also the possibility that there's something deeper at play here, such as a filesystem configuration issue, that's hard-coding permission bits (vfat, for instance, lacking any built-in support for permissions, has some flags that'll let you make everything stored on the filesystem 0777 with no means of changing it).

Good luck in your search. If you find anything specific that you'd like clarification on, please post it as a separate question and someone should be able to help you out.

womble
  • 95,029
  • 29
  • 173
  • 228
2

Check out what the "umask" is set to ...

check:

/var/cpanel/easy/apache/rawenv/umask

/usr/local/apache/bin/envvars

Look in /etc/init.d/apache2 or /etc/inet.d/httpd to verify the location of the envvars file.

The ".../rawenv/umask is used during the automated re-build for setting "envvars"

The "envvars" is used during start-up.