You don't have permission error in Apache in CentOS

后端 未结 2 1897
不思量自难忘°
不思量自难忘° 2021-02-09 14:09

I have installed apache 2.2 in centos 6. Everything worked fine when the apache folder was at its default location /var/www/html. Then I configured a Virtual host i

2条回答
  •  独厮守ぢ
    2021-02-09 14:26

    I solved the problem. After meddling with the permission of the system I found out that the user "anjan" who is owner of /home/anjan had read/write/execute permission on /home/anjan but the group "anjan", created when user "anjan" was created didn't have any permission at all.

    ls -l /home/
    

    showed

    drwx------. 28 anjan anjan 4096 Jan 21 13:19 anjan
    

    so I changed the permission with this command

    chmod -R 770 /home/anjan
    ls -l /home/
    drwxrwx---. 28 anjan anjan 4096 Jan 21 13:19 anjan
    

    i found out under which user my apache is running from this thread. It was running under user "apache"

    so I added user "apache" to group "anjan" with this command.

    usermod -G anjan,apache apache
    

    after that voila. No more Forbidden error.

    P.S. I did everything as the root user.

    UPDATE It seems the provided link is broken now. Heres another one.

    Just to be safe(to avoid future broken links), copying the command here. In terminal type -

    ps axo user,group,comm | grep apache
    

提交回复
热议问题