apache permission problems

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have some question about permission for my apache.



The following situation came in a test up:
I want to install wordpress and the setup told me that he can not create the file wp-config.php.
So I noticed that there is a permission problem. But how can I fix this?



All folders in var/www/html are owned by apache:apache and has 755 permissions (drwxr-xr-x).



What information you need to give me some suggestions?







share|improve this question





















  • I think apache runs as httpd user on centos, no ?
    – Kiwy
    Jun 6 at 9:51










  • I dunno know really. I installed apache with sudo yum -y apache
    – yfain
    Jun 6 at 9:55










  • what is the ouput of lsof -i TCP:80 edit your question so everybody knows also you should add the installation method to your question it could help Also did you created tha apache user ? if you did how did you ?
    – Kiwy
    Jun 6 at 10:19










  • lsof command not found
    – yfain
    Jun 6 at 11:11














up vote
0
down vote

favorite












I have some question about permission for my apache.



The following situation came in a test up:
I want to install wordpress and the setup told me that he can not create the file wp-config.php.
So I noticed that there is a permission problem. But how can I fix this?



All folders in var/www/html are owned by apache:apache and has 755 permissions (drwxr-xr-x).



What information you need to give me some suggestions?







share|improve this question





















  • I think apache runs as httpd user on centos, no ?
    – Kiwy
    Jun 6 at 9:51










  • I dunno know really. I installed apache with sudo yum -y apache
    – yfain
    Jun 6 at 9:55










  • what is the ouput of lsof -i TCP:80 edit your question so everybody knows also you should add the installation method to your question it could help Also did you created tha apache user ? if you did how did you ?
    – Kiwy
    Jun 6 at 10:19










  • lsof command not found
    – yfain
    Jun 6 at 11:11












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have some question about permission for my apache.



The following situation came in a test up:
I want to install wordpress and the setup told me that he can not create the file wp-config.php.
So I noticed that there is a permission problem. But how can I fix this?



All folders in var/www/html are owned by apache:apache and has 755 permissions (drwxr-xr-x).



What information you need to give me some suggestions?







share|improve this question













I have some question about permission for my apache.



The following situation came in a test up:
I want to install wordpress and the setup told me that he can not create the file wp-config.php.
So I noticed that there is a permission problem. But how can I fix this?



All folders in var/www/html are owned by apache:apache and has 755 permissions (drwxr-xr-x).



What information you need to give me some suggestions?









share|improve this question












share|improve this question




share|improve this question








edited Jun 6 at 9:21
























asked Jun 6 at 8:56









yfain

184




184











  • I think apache runs as httpd user on centos, no ?
    – Kiwy
    Jun 6 at 9:51










  • I dunno know really. I installed apache with sudo yum -y apache
    – yfain
    Jun 6 at 9:55










  • what is the ouput of lsof -i TCP:80 edit your question so everybody knows also you should add the installation method to your question it could help Also did you created tha apache user ? if you did how did you ?
    – Kiwy
    Jun 6 at 10:19










  • lsof command not found
    – yfain
    Jun 6 at 11:11
















  • I think apache runs as httpd user on centos, no ?
    – Kiwy
    Jun 6 at 9:51










  • I dunno know really. I installed apache with sudo yum -y apache
    – yfain
    Jun 6 at 9:55










  • what is the ouput of lsof -i TCP:80 edit your question so everybody knows also you should add the installation method to your question it could help Also did you created tha apache user ? if you did how did you ?
    – Kiwy
    Jun 6 at 10:19










  • lsof command not found
    – yfain
    Jun 6 at 11:11















I think apache runs as httpd user on centos, no ?
– Kiwy
Jun 6 at 9:51




I think apache runs as httpd user on centos, no ?
– Kiwy
Jun 6 at 9:51












I dunno know really. I installed apache with sudo yum -y apache
– yfain
Jun 6 at 9:55




I dunno know really. I installed apache with sudo yum -y apache
– yfain
Jun 6 at 9:55












what is the ouput of lsof -i TCP:80 edit your question so everybody knows also you should add the installation method to your question it could help Also did you created tha apache user ? if you did how did you ?
– Kiwy
Jun 6 at 10:19




what is the ouput of lsof -i TCP:80 edit your question so everybody knows also you should add the installation method to your question it could help Also did you created tha apache user ? if you did how did you ?
– Kiwy
Jun 6 at 10:19












lsof command not found
– yfain
Jun 6 at 11:11




lsof command not found
– yfain
Jun 6 at 11:11










2 Answers
2






active

oldest

votes

















up vote
0
down vote













You should allow the user on which privileges apache process is running to write to this file.
To check the name of user used by apache process you can run ps -ef | grep httpd and then set the owner for wp-config.php file but after installation will be finished you should disallow apache to make changes on this file.






share|improve this answer





















  • Thanks, but I need a solution that this will work for new folders and domains. I changed the owner to apache:apache for var/www/html/ and 755. But it is also not working.
    – yfain
    Jun 6 at 9:09











  • You changed permission for /var/www/html directory but what with files and sub-directories inside?
    – mariaczi
    Jun 6 at 9:13










  • Also changed to this.
    – yfain
    Jun 6 at 9:13










  • OK, you use mod_php with apache or php-fpm?
    – mariaczi
    Jun 6 at 9:14










  • I use CGI for PHP
    – yfain
    Jun 6 at 9:16

















up vote
0
down vote













we need to temporarily grant httpd_sys_rw_content_t to the WordPress directory. This is to allow the initial wizard to create the wp-config.php file.



sudo chcon -t httpd_sys_rw_content_t /var/www/html/wordpress/


Now you can run the wizard and it will work properly.



Once your site is set up, restore the context to http_sys_content_t



sudo restorecon -v /var/www/html/wordpress/





share|improve this answer





















  • Is there a way to enable this always?
    – yfain
    Jun 6 at 9:51










  • then don't restore the context.
    – SivaPrasath
    Jun 6 at 9:57










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f448130%2fapache-permission-problems%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













You should allow the user on which privileges apache process is running to write to this file.
To check the name of user used by apache process you can run ps -ef | grep httpd and then set the owner for wp-config.php file but after installation will be finished you should disallow apache to make changes on this file.






share|improve this answer





















  • Thanks, but I need a solution that this will work for new folders and domains. I changed the owner to apache:apache for var/www/html/ and 755. But it is also not working.
    – yfain
    Jun 6 at 9:09











  • You changed permission for /var/www/html directory but what with files and sub-directories inside?
    – mariaczi
    Jun 6 at 9:13










  • Also changed to this.
    – yfain
    Jun 6 at 9:13










  • OK, you use mod_php with apache or php-fpm?
    – mariaczi
    Jun 6 at 9:14










  • I use CGI for PHP
    – yfain
    Jun 6 at 9:16














up vote
0
down vote













You should allow the user on which privileges apache process is running to write to this file.
To check the name of user used by apache process you can run ps -ef | grep httpd and then set the owner for wp-config.php file but after installation will be finished you should disallow apache to make changes on this file.






share|improve this answer





















  • Thanks, but I need a solution that this will work for new folders and domains. I changed the owner to apache:apache for var/www/html/ and 755. But it is also not working.
    – yfain
    Jun 6 at 9:09











  • You changed permission for /var/www/html directory but what with files and sub-directories inside?
    – mariaczi
    Jun 6 at 9:13










  • Also changed to this.
    – yfain
    Jun 6 at 9:13










  • OK, you use mod_php with apache or php-fpm?
    – mariaczi
    Jun 6 at 9:14










  • I use CGI for PHP
    – yfain
    Jun 6 at 9:16












up vote
0
down vote










up vote
0
down vote









You should allow the user on which privileges apache process is running to write to this file.
To check the name of user used by apache process you can run ps -ef | grep httpd and then set the owner for wp-config.php file but after installation will be finished you should disallow apache to make changes on this file.






share|improve this answer













You should allow the user on which privileges apache process is running to write to this file.
To check the name of user used by apache process you can run ps -ef | grep httpd and then set the owner for wp-config.php file but after installation will be finished you should disallow apache to make changes on this file.







share|improve this answer













share|improve this answer



share|improve this answer











answered Jun 6 at 9:08









mariaczi

42915




42915











  • Thanks, but I need a solution that this will work for new folders and domains. I changed the owner to apache:apache for var/www/html/ and 755. But it is also not working.
    – yfain
    Jun 6 at 9:09











  • You changed permission for /var/www/html directory but what with files and sub-directories inside?
    – mariaczi
    Jun 6 at 9:13










  • Also changed to this.
    – yfain
    Jun 6 at 9:13










  • OK, you use mod_php with apache or php-fpm?
    – mariaczi
    Jun 6 at 9:14










  • I use CGI for PHP
    – yfain
    Jun 6 at 9:16
















  • Thanks, but I need a solution that this will work for new folders and domains. I changed the owner to apache:apache for var/www/html/ and 755. But it is also not working.
    – yfain
    Jun 6 at 9:09











  • You changed permission for /var/www/html directory but what with files and sub-directories inside?
    – mariaczi
    Jun 6 at 9:13










  • Also changed to this.
    – yfain
    Jun 6 at 9:13










  • OK, you use mod_php with apache or php-fpm?
    – mariaczi
    Jun 6 at 9:14










  • I use CGI for PHP
    – yfain
    Jun 6 at 9:16















Thanks, but I need a solution that this will work for new folders and domains. I changed the owner to apache:apache for var/www/html/ and 755. But it is also not working.
– yfain
Jun 6 at 9:09





Thanks, but I need a solution that this will work for new folders and domains. I changed the owner to apache:apache for var/www/html/ and 755. But it is also not working.
– yfain
Jun 6 at 9:09













You changed permission for /var/www/html directory but what with files and sub-directories inside?
– mariaczi
Jun 6 at 9:13




You changed permission for /var/www/html directory but what with files and sub-directories inside?
– mariaczi
Jun 6 at 9:13












Also changed to this.
– yfain
Jun 6 at 9:13




Also changed to this.
– yfain
Jun 6 at 9:13












OK, you use mod_php with apache or php-fpm?
– mariaczi
Jun 6 at 9:14




OK, you use mod_php with apache or php-fpm?
– mariaczi
Jun 6 at 9:14












I use CGI for PHP
– yfain
Jun 6 at 9:16




I use CGI for PHP
– yfain
Jun 6 at 9:16












up vote
0
down vote













we need to temporarily grant httpd_sys_rw_content_t to the WordPress directory. This is to allow the initial wizard to create the wp-config.php file.



sudo chcon -t httpd_sys_rw_content_t /var/www/html/wordpress/


Now you can run the wizard and it will work properly.



Once your site is set up, restore the context to http_sys_content_t



sudo restorecon -v /var/www/html/wordpress/





share|improve this answer





















  • Is there a way to enable this always?
    – yfain
    Jun 6 at 9:51










  • then don't restore the context.
    – SivaPrasath
    Jun 6 at 9:57














up vote
0
down vote













we need to temporarily grant httpd_sys_rw_content_t to the WordPress directory. This is to allow the initial wizard to create the wp-config.php file.



sudo chcon -t httpd_sys_rw_content_t /var/www/html/wordpress/


Now you can run the wizard and it will work properly.



Once your site is set up, restore the context to http_sys_content_t



sudo restorecon -v /var/www/html/wordpress/





share|improve this answer





















  • Is there a way to enable this always?
    – yfain
    Jun 6 at 9:51










  • then don't restore the context.
    – SivaPrasath
    Jun 6 at 9:57












up vote
0
down vote










up vote
0
down vote









we need to temporarily grant httpd_sys_rw_content_t to the WordPress directory. This is to allow the initial wizard to create the wp-config.php file.



sudo chcon -t httpd_sys_rw_content_t /var/www/html/wordpress/


Now you can run the wizard and it will work properly.



Once your site is set up, restore the context to http_sys_content_t



sudo restorecon -v /var/www/html/wordpress/





share|improve this answer













we need to temporarily grant httpd_sys_rw_content_t to the WordPress directory. This is to allow the initial wizard to create the wp-config.php file.



sudo chcon -t httpd_sys_rw_content_t /var/www/html/wordpress/


Now you can run the wizard and it will work properly.



Once your site is set up, restore the context to http_sys_content_t



sudo restorecon -v /var/www/html/wordpress/






share|improve this answer













share|improve this answer



share|improve this answer











answered Jun 6 at 9:50









SivaPrasath

4,32712141




4,32712141











  • Is there a way to enable this always?
    – yfain
    Jun 6 at 9:51










  • then don't restore the context.
    – SivaPrasath
    Jun 6 at 9:57
















  • Is there a way to enable this always?
    – yfain
    Jun 6 at 9:51










  • then don't restore the context.
    – SivaPrasath
    Jun 6 at 9:57















Is there a way to enable this always?
– yfain
Jun 6 at 9:51




Is there a way to enable this always?
– yfain
Jun 6 at 9:51












then don't restore the context.
– SivaPrasath
Jun 6 at 9:57




then don't restore the context.
– SivaPrasath
Jun 6 at 9:57












 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f448130%2fapache-permission-problems%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?