File still unwriteable in /var/www/html after the chmod command

11,958

This problem has been settled by command setenforce 0, which would shut down SELinux.

How silly I am! I never thought about this stuff.

Thanks Flimzy and njd anyway.

Share:
11,958

Related videos on Youtube

Isabella Martelloni
Author by

Isabella Martelloni

College student majored in software engineering.

Updated on September 18, 2022

Comments

  • Isabella Martelloni
    Isabella Martelloni over 1 year

    I've got some trouble while trying to install some applications on my linux system. It is said that the files in my /var/www/html/xxx directory, where I put them, is not writeable. The command chmod 777 xxx has been tried to make it work, but the error remains when I opened the applications again.

    To be specific, I want to install phpFreeChat on my system, so I put those files in the /var/www/html/freechat directory, cd there and typed chmod 777 data/private, chmod 777 data/public on bash. Here's the result of list -al data:

    drwxr-xr-x.  4 root root 4096  Jun 17 15:07 .
    drwxr-xr-x. 13 root root 4096  Jun 17 15:22 ..
    drwxrwxrwx.  2 root root 4096  Jun 17 15:07 private
    drwxrwxrwx.  3 root root 4096  Jun 17 15:07 public
    

    These all seemed all right to me, until I typed http://localhost/freechat in my browser. Here's the result:

    phpFreeChat cannot be initialized, please correct these errors:

    /var/www/html/freechat/src/../data/private is not writeable /var/www/html/freechat/src/../data/private/cache can't be created /var/www/html/freechat/src/../data/private/cache is not writeable /var/www/html/freechat/src/../data/private/cache is not readable cannot create /var/www/html/freechat/src/../data/public/themes/default cannot create /var/www/html/freechat/src/../data/public/themes/default /var/www/html/freechat/src/../data/private/chat can't be created /var/www/html/freechat/src/../data/private/chat is not writeable /var/www/html/freechat/src/../data/private/chat is not readable /var/www/html/freechat/src/../data/private/chat/s_d0ba868e1391b6c0d897996049a68ada can't be created /var/www/html/freechat/src/../data/private/chat/s_d0ba868e1391b6c0d897996049a68ada is not writeable /var/www/html/freechat/src/../data/private/chat/s_d0ba868e1391b6c0d897996049a68ada is not readable

    I'm quite confused with this because this situation did not only happen in the installation of this application but all. Mistakes must be made by me, but what is it?

    • vtest
      vtest almost 13 years
      Doing chmod 777 is wrong. I suggest you to look into mod_userdir and user directories.
  • Isabella Martelloni
    Isabella Martelloni almost 13 years
    Thanks, but the error remains even if I use the recursive method to make it in mode 777.
  • njd
    njd almost 13 years
    Them either the chmod command didn't work, because you ran it as a normal user, and not as root; or you need to ensure that the preceding directories (/var/www/html/freechat and so on back up to /) are at least searchable (execute flag) by whichever account is used for the httpd service.
  • Isabella Martelloni
    Isabella Martelloni almost 13 years
    dr-xr-xr-x is the / directory and drwxr-xr-x are the others. No x missing in any directory.
  • Isabella Martelloni
    Isabella Martelloni almost 13 years
    There's a reason to believe that chmod command worked for those directories are indeed drwxrwxrwx, unless ls -al cheated me. :)
  • Isabella Martelloni
    Isabella Martelloni almost 13 years
    And I've tried chown these directories to apache.apache, which is set by /etc/httpd/conf/httpd.conf. The result didn't change a least.