Jump to content

Recommended Posts

[rbredlau@localhost public_html]$ ls -l
total 16
-rw-r--r-- 1 rbredlau rbredlau 93 Aug 19 14:49 index.html
-rw-r--r-- 1 rbredlau rbredlau 19 Aug 20 11:37 index.php
[rbredlau@localhost public_html]$ umask -S
u=rwx,g=rwx,o=rx
[rbredlau@localhost public_html]$ touch junk
[rbredlau@localhost public_html]$ ls -l
total 20
-rw-r--r-- 1 rbredlau rbredlau 93 Aug 19 14:49 index.html
-rw-r--r-- 1 rbredlau rbredlau 19 Aug 20 11:37 index.php
-rw-rw-r-- 1 rbredlau rbredlau  0 Aug 20 11:57 junk
[rbredlau@localhost public_html]$ namei -m /home/rbredlau/public_html/
f: /home/rbredlau/public_html/
drwxr-xr-x /
drwxr-xr-x home
drwxr-xr-x rbredlau
drwxr-xr-x public_html
[rbredlau@localhost public_html]$ uname -a
Linux localhost.localdomain 2.6.18-128.4.1.el5 #1 SMP Tue Aug 4 20:23:34 EDT 2009 i686 i686 i386 GNU/Linux
[rbredlau@localhost public_html]$ cat /etc/redhat-release
CentOS release 5.3 (Final)

 

Can someone explain to me why junk is not picking up the permissions set by umask?

Link to comment
https://forums.phpfreaks.com/topic/171190-file-permissions-umask-ignored/
Share on other sites

Because that would be a huge security issue.  By default your files shouldn't be executable, although if you mkdir a directory it will be.  It is picking up the permissions, just not the executable one.  Why would you want everyone to have executable rights anyway?

This is a fresh install, the current umask is the default, and I will be changing it.  But in the meantime I'd like to know what it is that causes files to drop the x permission when umask says they should have it?

This is a fresh install, the current umask is the default, and I will be changing it.  But in the meantime I'd like to know what it is that causes files to drop the x permission when umask says they should have it?

 

User mask can't let you create executable files by default.  Like I said, that would be a huge security issue.  It ensures arbitrary files aren't misused as executables until you say so with an explicit chmod, at least to my understanding.

 

So I guess it's just a built in security feature, forcing you to go out of your way to make files executable.

 

It's a silly question, I know, but I'm vaguely familiar with *nix and this was unexpected behavior.

 

Thanks :)

No.  None of the files will be executable.

 

I guess the source of my question, as silly as the question is, came about from my impression that linux will happily do whatever you tell it to because it assumes you know what you're doing.  But I guess it has some additional safeguards built in to ward off stupid administrator mistakes.

Hrmmm interesting....  According to Wikipedia (which means who knows how accurate this is):

 

 

The umask only restricts permissions; it cannot grant extra permissions beyond what is specified by the program that creates the file or directory. When programs create files, they usually specify read and write permissions for all users, and no execute permissions at all (rw-rw-rw- or octal 666 in traditional Unix notation).[1][2][3] Files created in this way will not be executable even if the umask would have allowed that.

 

 

http://en.wikipedia.org/wiki/Umask#Effect_of_the_umask

 

 

 

So it sounds like it could actually be touch that's restricting it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.