Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File not writeable even though permissions are 777

Something really weird is going on.

httpd.conf says apache runs as the apache user.

I have chown-ed the files to be apache:apache.

The file is still not writeable.

I have set the permissions (of the entire webroot as a last resort) to be 777 and the file is still not writeable...

The path is correct because file_exists() is true but is_writeable is false.

Any ideas?

like image 802
guided1 Avatar asked Mar 22 '12 08:03

guided1


People also ask

What the problem is if we chmod 777 for all the files?

The problem is that if someone can penetrate your system as a user other than yourself, if your files are CHMOD 777, they can read, write, execute and delete them. This is considered a security threat.

What does chmod 777 filename do?

Changing File Permissions Using chmod 777 It means to make the file readable, writable and executable by everyone with access.


1 Answers

It's more than possible that you have SELinux running on the machine. To check whether it's running or not you should be able to run the getenforce command on the commandline. If it returns "Enforcing" then SELinux is enabled and running in enforcing mode.

I'd suggest that in most cases (unless you want to spend days learning about SElinux) that you disable it by running setenforce Permissive and editing /etc/sysconfig/selinux so that next time the server restarts it won't reactivate it.

If you're sure you don't need SELinux you could just remove the packages from the server

like image 165
James C Avatar answered Sep 22 '22 19:09

James C