Magneto directory / file ownership, and becoming the apache user

Keith Smith techlists at phpcoderusa.com
Fri Feb 24 08:13:18 MST 2017


On 2017-01-26 08:39, Matt Graham wrote:
> On 2017-01-25 17:46, Keith Smith wrote:
>> I am on CentOS 7.  Magento offers a command line utility - bin/magento 
>> which
>> can do a number of things such as enable or disable modules, clear 
>> cache etc.
>> It also creates files.  I ran the Magento command as root and the 
>> files it
>> created were owned by root.
>> 
>> I tried to become the apache user with command : su - apache  which
>> returned "This account is currently not available."
> 
> If you look in /etc/passwd , you'll probably see that the shell for
> the apache user is /sbin/nologin.  This means that the apache user has
> no shell, is not allowed to log in, and you can't use su to become
> that user.  A lot of the non-user users on Redhat-ish systems are set
> up like that.
> 
>> At this point I have to become root and do a chown apache -R 
>> magento-directory.
> 
> If you're going to be changing the files in apache's DocumentRoot
> frequently, then why not make it so that those files are owned by your
> user instead of apache?

Because Magento will not be able to write files as it needs to such as 
cache and php code it auto generates.

> That'd make it a heck of a lot more
> convenient. Changing the ownership of apache's config files is
> potentially less useful because IIRC restarting apache requires you to
> be root anyway.

-- 
Keith Smith


More information about the PLUG-discuss mailing list