Magneto directory / file ownership, and becoming the apache user

Matt Graham mhgraham at crow202.org
Thu Jan 26 08:39:44 MST 2017


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?  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.

-- 
Crow202 Blog: http://crow202.org/wordpress
There is no Darkness in Eternity
But only Light too dim for us to see.


More information about the PLUG-discuss mailing list