roopurt18 Posted August 20, 2009 Share Posted August 20, 2009 [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? Quote Link to comment https://forums.phpfreaks.com/topic/171190-file-permissions-umask-ignored/ Share on other sites More sharing options...
Maq Posted August 20, 2009 Share Posted August 20, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/171190-file-permissions-umask-ignored/#findComment-902757 Share on other sites More sharing options...
roopurt18 Posted August 20, 2009 Author Share Posted August 20, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/171190-file-permissions-umask-ignored/#findComment-902785 Share on other sites More sharing options...
Maq Posted August 20, 2009 Share Posted August 20, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/171190-file-permissions-umask-ignored/#findComment-902795 Share on other sites More sharing options...
roopurt18 Posted August 20, 2009 Author Share Posted August 20, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/171190-file-permissions-umask-ignored/#findComment-902809 Share on other sites More sharing options...
corbin Posted August 20, 2009 Share Posted August 20, 2009 I can't help but notice that you're in a folder called public_html.... You aren't setting your .php files as executable are you? (Don't think you are since the one in the directory isn't, but just making sure.) Quote Link to comment https://forums.phpfreaks.com/topic/171190-file-permissions-umask-ignored/#findComment-902818 Share on other sites More sharing options...
roopurt18 Posted August 20, 2009 Author Share Posted August 20, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/171190-file-permissions-umask-ignored/#findComment-902863 Share on other sites More sharing options...
corbin Posted August 20, 2009 Share Posted August 20, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/171190-file-permissions-umask-ignored/#findComment-902910 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.