DWvdM
DWvdM

Reputation: 23

No single directory is writable Joomla

Some really strange happened to me, while migrating my websites from a hoster to my new VPS with CentOS 6, DirectAdmin (and Jira Image V6, optimized for Magento and Joomla).

I migrated one website succesfully, without any problems. The first one. It really works like a charm!

All other websites, with the same Joomla! version, I tried to copy, had the same problems of no single directory or file is writable. I checked all settings, everywhere, as far as my knowledge goes, but nothing. The copy method was exactly the same, as the first one.

What I did and tried so far:

I tried manually uploading, downloading and extracting using SSH, resetting owner via DA.

I also tried to put in php.ini > open_basedir = /tmp/ , which resulted in a blank page. (possibly something?)

I can see the website, I can login into backend, I can use FTP, but I can not modify anything in settings, I can not install anything, I checked the permissions overview and everything is very red, like: Unwritable, really every file and directory. And that is not good.

Additional info:

I am kind of desperate, while reuploading, VPS reinstalling, etc, etc, doesn't work! Who can point me into the right direction?

Upvotes: 1

Views: 3031

Answers (4)

DWvdM
DWvdM

Reputation: 23

I was really desperate and hired a kind of addict in (from distance). He was able to point me at the following fact (for free!) :

I was moving the websites to my new server, and I wanted to make the website ready and working before making it live, and that was the mistake.

I kept working on the website with de URL http://xxx.xxx.xxx.xxx/~user/

I didn't want to make the site live, so change the DNS, until the site worked. BUT...!!! The site will never fully work in upper scenario, and only works with a static address, so http://(subdomain).yourdomain.com for example.

First thing for me was to immediatly change the DNS, and guess what? It works... I spend really 36 hours or more on this, but I hope I can help others with this, because I never NEVER did see this option, and it is written nowhere! Until now...

Upvotes: 0

Riccardo Zorn
Riccardo Zorn

Reputation: 5615

I guess your site is running under a user you are not expecting (or you ran out of disk space). All commands below are meant to be run from the site webroot, i.e. where the index.php is:

cd /home/yourwebsite/html

or whatever is your server path.

Wrong user is the most frequent as tar will by default mantain the original owner id.

Just make the images folder 777

chmod -R 777 images

and upload a file with media manager.

ls -la images/*

-rw-r--r-- 1 fasterjoomla fasterjoomla   31 Apr 26 13:12 index.html
-rw-r--r-- 1 fasterjoomla fasterjoomla 3746 Apr 26 13:12 joomla_black.gif
-rw-r--r-- 1 apache       webserver    2301 Jul 16 11:57 test.png

locate your freshly uploaded image: the beginning of the line will tell you the owner and group, for example here test.png is owned by user apache and group webserver.

Now change the ownership of the whole Joomla installation to that except for the configuration.php, administrator or any other files you may want to protect:

chown -R username:usergroup *

After this you can restore the permissions as per your standard 555/755 and your problem should be solved.

chmod -R 555 *
chmod -R 755 images logs tmp cache
rm -f images/test.png

or whatever is appropriate per your security policy.

Upvotes: 1

Elin
Elin

Reputation: 6755

I know you said you checked it, but usually if you have to use FTP (and there is a reason that was implemented which is this situation) it means that there is a file ownership problem and that suphp or similar are not installed/operational.

The tricky thing with the ftp is that you need to get the credentials saved to be able to use it and if you are in this situation you can't save the configuration.php with the credentials. That's why on a new installation with this situation you would have been prompted for the credentials and then this would have saved. If you can go to your file system and edit configuration.php to put in that data it would provide the immediate solution.

However the real solution is to either have the apache extensions like mod_suphp that will manage this or to deal with the ownership problem. Joomla needs to be able to own the folders/files when it is doing thing like installing extensions and so on.

Upvotes: 0

Jarek.D
Jarek.D

Reputation: 1294

What is the Linux distro you migrated from?

One potential source of problems when moving to CentOS is the fact that its default configuration is much more secure (SELinux, secure php.ini settings ect). For instance php_ini is disabled along with exec and a few other commands ect.

Also the apache user can't access anything outside web-root directory.

So there's many little things like that and that is probably why most of your application won't run

hth

Upvotes: 0

Related Questions