It would have helpful to know a few things ... like what operating system, what web server, and if remotely hosted (provider?) or not ... but the following is generic enough to be helpful (maybe). Assumes apache web server and not remotely hosted.
Moodle requires the data directory to be readable and writable by 'apache' (user under which the web service runs) user and group. If one were on Linux/CentOS, the fix is simple from the location where one can see the 'moodledata' directory via command line:
chown apache:apache moodledata -R
The moodledata directory *should not* be in web servers document root. For CentOS/RHEL (Linux) again that is most often: /var/www/html/ Anything in there (if not restricted in some other fashion) can be viewed by anyone browsing to it.
The data directory most often in /var/www/ - which is accessible by apache user. So the 'moodledata' directory would be:
in the config.php file.
'spirit of sharing', Ken