{"id":1448,"date":"2016-06-09T09:50:56","date_gmt":"2016-06-09T08:50:56","guid":{"rendered":"https:\/\/www.hutsky.cz\/blog\/?p=1448"},"modified":"2017-04-17T11:04:44","modified_gmt":"2017-04-17T10:04:44","slug":"apache-and-umask-002","status":"publish","type":"post","link":"https:\/\/www.hutsky.cz\/blog\/2016\/06\/apache-and-umask-002\/","title":{"rendered":"Apache and umask 002"},"content":{"rendered":"<p style=\"text-align: justify;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-thumbnail wp-image-1449\" src=\"https:\/\/www.hutsky.cz\/blog\/wp-content\/uploads\/download-150x150.png\" alt=\"download\" width=\"150\" height=\"150\" \/>I ran into a\u00a0problem with Apache on Centos 6. For some time, I was the only person who had access to this particular machine\u00a0so permissions were not a problem. However, now that somebody else is taking care of the website hosted there, they had troubles editing files that were uploaded via website and owned by apache. So I added the user to the <em>apache<\/em> group and put this line:<\/p>\n<pre class=\"\">umask 002<\/pre>\n<p>into file:<\/p>\n<pre class=\"\">\/etc\/sysconfig\/httpd<\/pre>\n<p style=\"text-align: justify;\">That way, any file created by apache user was by default writable by the <em>apache<\/em> group so the given user would be able to work with those files. When I tried it out, however, it didn&#8217;t work, the user was not able to modify those files, to my frustration. Now, I was left with two options, either pull my hair off, or modify the httpd init script, neither of them much to my liking. Eventually, I found out that the solution was pretty easy &#8211; the PHP upload script was explicitly setting the permissions to 644 so members of <em>apache<\/em> group were not able to modify the file. When I modified the application and its <em>chmod<\/em> command, everything worked like a charm.<\/p>\n<p style=\"text-align: justify;\"><strong><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-1523\" src=\"https:\/\/www.hutsky.cz\/blog\/wp-content\/uploads\/5d52e29c2.png\" alt=\"\" width=\"100\" height=\"21\" \/>Update 17. 4. 2017<\/strong><\/p>\n<p style=\"text-align: justify;\">I came to face the same situation with <strong>nginx on Centos 7<\/strong>. The issue was basically the same, only the file where umask directive had to be placed to was different:<\/p>\n<pre class=\"\" style=\"text-align: justify;\">\/lib\/systemd\/php-fpm.service<\/pre>\n<p style=\"text-align: justify;\">and umask had to be placed into the [Service] section:<\/p>\n<pre class=\"\" style=\"text-align: justify;\">[Service]\r\n#other stuff here\r\nUMask=0002<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I ran into a\u00a0problem with Apache on Centos 6. For some time, I was the only person who had access to this particular machine\u00a0so permissions were not a problem. However, now that somebody else is taking care of the website &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.hutsky.cz\/blog\/2016\/06\/apache-and-umask-002\/\"> <span class=\"screen-reader-text\">Apache and umask 002<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,22],"tags":[53,39,18,54,42],"class_list":["post-1448","post","type-post","status-publish","format-standard","hentry","category-operatingsystems","category-web-related","tag-apache","tag-centos","tag-linux","tag-nginx","tag-web"],"_links":{"self":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts\/1448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/comments?post=1448"}],"version-history":[{"count":16,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts\/1448\/revisions"}],"predecessor-version":[{"id":1524,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts\/1448\/revisions\/1524"}],"wp:attachment":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/media?parent=1448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/categories?post=1448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/tags?post=1448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}