Magneto directory / file ownership, and becoming the apache user

Nathan plug-discuss at nmecs.com
Tue Jan 31 10:45:57 MST 2017


A couple more ideas,

1) Create a new user with the same uid as apache, then that user will 
have write access to the /var/www/html directory

2) Change apache to run as a specific user you choose with login 
abilities and write ability. This means you edit 
/etc/httpd/conf/httpd.conf and change the lines that say
User apache
Group apache
to the user and group you want to use.


I personally tend to setup a specific user, change apache and php to run 
as that user, then setup an rsync job to watch my local directory tree 
and rsync the files to the remote server on change using inotify.





On 2017-01-25 17:46, Keith Smith wrote:
> Hi,
> 
> I am learning Magento 2.  Magento suggests setting the file/director
> owner to Apache if on CentOS.  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."
> 
> I Assume it would would be best to become the apache user while
> working from the command line on Magento.
> 
> Is my thought process reasonable?  And id so how do I modify the
> apache user to I can become the apache user?  Or is there a better
> practice.
> 
> At this point I have to become root and do a chown apache -R 
> magento-directory.
> 
> Thanks in advance for your help!!
> 
> Keith
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss

-- 
Regards,

Nathan


More information about the PLUG-discuss mailing list