Where is the best place to put the moodledata directory?

Where is the best place to put the moodledata directory?

by Eric Hagley -
Number of replies: 14
I have just updated to the latest 1.6.2. When I go through the admin side of the upgrade I get a message saying "Your site configuration might not be secure. Please make sure that your dataroot directory (/home/eg/public_html/meiho/moodledata) is not directly accessible via web" 
I have the path directory along the lines of

public_html/meiho/moodle
with moodledata at
public_html/meiho/moodledata

I have put an index.html file in the meiho directory so that the moodledata directory is not immediately visible but if someone works out the actual directory name then obviously they will be able to see it.

Where is the best place to put the directory and stop people from seeing it?
I have looked at the security.moodle section but can't seem to see any specific places where one should put the directory - there are a few places stated as being NOT good, but none that say where specifically to put it. I use Cpanel.
Any ideas would be greatly appreciated.
All the best,
Eric
Average of ratings: -
In reply to Eric Hagley

Re: Where is the best place to put the moodledata directory?

by Dan Stowell -
It should be anywhere you like, but NOT IN public_html.
In reply to Dan Stowell

Re: Where is the best place to put the moodledata directory?

by Martín Langhoff -
Indeed. If you are on linux, and want to follow the standard (LSB), put it in /var/moodledata . This will work with all linuxes, and is the "canonically correct" place. It also fits how Debian and RH distros lay things out.

(There is a variation. If you absolutely know that /var/www isn't published, and /var/www/htdocs or /var/www/{sitename}/htdocs is published instead, then go for /var/www/moodledata or /var/www/{sitename}/moodledata. This would apply to Etch and the most recent Ubuntu releases, which install Apache2 with that kind of configuration for virtualhosts.)

On the other hand, if you are on SuSE/Novell, these things land in /srv and moodle itself is in /srv/www/htdocs. In that case put it in /srv/www/moodledata.

But all this stuff about canonical places is just for elegance, ease of backup tool configuration and keeping sysadmins employed. In case of doubt, the only rule that matters is the one Dan put forth.

... And don't put it in /tmp or /var/tmp either! big grin

[this comment brought to you by the league of pedantic linux users]
In reply to Martín Langhoff

Re: Where is the best place to put the moodledata directory?

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
> It also fits how Debian and RH distros lay things out.

Uh? At least Debian doesn't lay things out that way. Debian places moodledata at /var/lib/moodle by default (both in Sarge, Sid and Etch).

Saludos. Iñaki.

(this comment brought to you by an even more pedantic linux user evil )
In reply to Iñaki Arenaza

Re: Where is the best place to put the moodledata directory?

by Pedro Parreira -
Hello.

I can't create folders inside "/var/lib" so I'm trying to use "home/pmp/moodledata" as my moodledata folder. The thing is that the moodle installation tells me it 'can't create or find the moodledata folder, that I must create it manually and give read and write permission to user nobody, apache or www-data.'

Now, I've already created the folder manually, so I suspect its complaining about the permissions. My question is how do I set permissions to all users to write on this folder since the current folder permissions are drwxr-xr-x?

When I try to change ownership to user apache I get: invalid user and to nobody and www-data I get: Operation not permitted
In reply to Pedro Parreira

Re: Where is the best place to put the moodledata directory?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
chmod a+w moodledata

should do it.

However, I recommend you learn a bit more about Linux, so you understand what you are doing wink
In reply to Tim Hunt

Re: Where is the best place to put the moodledata directory?

by Pedro Parreira -
Thanks. That worked. And I understand I'm giving permission to all users to write in this directory. piscando Now I have to create the database. Any idea how this could be done with XAMPP?
In reply to Pedro Parreira

Re: Where is the best place to put the moodledata directory?

by Pedro Parreira -
Pfiuuu! sonolento I finally got Moodle working in Linux. Thank you God. Thank you All.
In reply to Dan Stowell

Re: Where is the best place to put the moodledata directory?

by Eric Hagley -
Now, I'm not a linux user or anything else other than a pretty simple old Cpanel user and pretty green behind the ears there too. But this is what I did and I'd like to know if anyone thinks it is good/bad/an improvement/ but preferably if it is ideal. I would like an "ideal" setup!

What I did:

I opened my Cpanel and clicked on file manager. In that very first screen I created a new folder and called it (for example) moddata. This folder is obviously therefore outside the public_html folder. I then moved my moodledata file from the directory it was previously in and placed it in this directory / folder. (By creating a folder you are creating a directory is my understanding of it.) I then went to the config.php file and editted it so that the $CFG->dataroot was pointing to that folder / directory. I saved that file.

I went back to the admin page of the moodle site and the warning about the security issue was no longer there. Presuming therefore that the problem is fixed however if there is a better way of doing things then I would very much like to know. Any ideas are greatly appreciated.

Might I just note that fantastico setups put the moodledata directory in public_html. This is perhaps yet another reason not to use fantastico to setup moodle??? Totally separate issue, but does moodle get any money from fantastico?

Kind regards,
Eric
In reply to Eric Hagley

Re: Where is the best place to put the moodledata directory?

by Martín Langhoff -
> Might I just note that fantastico setups put the
> moodledata directory in public_html.

Good idea to report a bug against Fantastico. I hear they are pretty good and responsive -- they package up new versions of moodle in quite a timely fashion. So it shouldn't be a prob for them to do something more sensible...
In reply to Martín Langhoff

Re: Where is the best place to put the moodledata directory?

by elearning edu -

Safe bet is outside public_html  The ASP model envisages moodledata for each account to have exclisivity.  Fantastico uses uploaddata instead of moodledata.  The worry is to keep the data in the public area in fantastico

Nagarajan

In reply to elearning edu

Re: Where is the best place to put the moodledata directory?

by Greg Greg -
I did this as eric suggested and it worked except when i log in as administrator I cannot see site administration panel. any suggestions?
In reply to Greg Greg

Re: Where is the best place to put the moodledata directory?

by Richard Enison -
GG,

Are you implying there is a connection between the location of moodledata and your admin. panel problem? Did the panel appear before you moved moodledata?

BTW pls see http://docs.moodle.org/en/Installation_FAQ#System_information_needed_for_Installation_Forum

RLE
In reply to Richard Enison

Re: Where is the best place to put the moodledata directory?

by Greg Greg -
yes my site administration panel was there until I moved the moodledata folder and renamed the data in the config folder to that location. I then could still log in but could not do anything because the admin panel was gone.  when i renamed back and put folder back I could see admin panel again.
In reply to Greg Greg

Re: Where is the best place to put the moodledata directory?

by Richard Enison -
GG,

This is a very strange problem which I have never seen reported before. It is strange because I cannot imagine what the location of moodledata has to do with the admin panel. I'll let you know if I find the connection.

The first thing I would want to determine, when you are not getting the admin panel, is whether you are still logged in as administrator. There ought to be a simple way to find out without patching the code with debug print statements, but offhand I can't think of any. I'll get back to you when I do.

RLE