[202] Data folder permisions error #262

Closed
MrKeiKun opened this Issue Jul 31, 2014 · 27 comments

Comments

Projects
None yet

Information:
Im using rainloop from github src, I installed once before on another server. Worked fine same procedures. Now im running centos7.

I already ran

cd /var/www/rainloop
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

still not working

[root@neko www]# pwd
/var/www
[root@neko www]# ls -lha
total 28K
drwxr-xr-x.  7 root root 4.0K Jul 31 07:12 .
drwxr-xr-x. 21 root root 4.0K Jul 29 12:42 ..
drwxr-xr-x.  2 root root 4.0K Jul 23 10:48 cgi-bin
drwxr-xr-x.  2 root root 4.0K Jun  9 22:32 html
drwxr-xr-x. 10 root root 4.0K Jul 31 07:12 rainloop
total 92K
drwxr-xr-x. 10 root root 4.0K Jul 31 07:12 .
drwxr-xr-x.  7 root root 4.0K Jul 31 07:12 ..
drwxr-xr-x.  4 root root 4.0K Jul 31 07:12 build
drwxrwxrwx.  2 root root 4.0K Jul 31 07:18 data
drwxr-xr-x. 12 root root 4.0K Jul 31 07:12 dev
drwxr-xr-x.  8 root root 4.0K Jul 31 07:12 .git
-rw-r--r--.  1 root root  126 Jul 31 07:12 .gitignore
-rw-r--r--.  1 root root  19K Jul 31 07:12 gulpfile.js
-rw-r--r--.  1 root root  214 Jul 31 07:12 _include.php
-rw-r--r--.  1 root root  428 Jul 31 07:12 index.php
-rw-r--r--.  1 root root 1.2K Jul 31 07:12 .jshintrc
-rw-r--r--.  1 root root 1.5K Jul 31 07:12 LICENSE
-rw-r--r--.  1 root root   69 Jul 31 07:12 _MULTIPLY
-rw-r--r--.  1 root root 1.2K Jul 31 07:12 package.json
drwxr-xr-x. 20 root root 4.0K Jul 31 07:12 plugins
drwxrwxrwx.  3 root root 4.0K Jul 31 07:12 rainloop
-rw-r--r--.  1 root root  791 Jul 31 07:12 README.md
drwxr-xr-x.  4 root root 4.0K Jul 31 07:12 tests
drwxr-xr-x. 32 root root 4.0K Jul 31 07:12 vendors
Owner

RainLoop commented Jul 31, 2014

755 and 644 works with apache/nginx user only.
If you want to use root owner fo files, you shoud set 775 and 664.

cd /var/www/rainloop
find . -type d -exec chmod 775 {} \;
find . -type f -exec chmod 664 {} \;

@RainLoop

still not working
have you guys even tested this over centos 6.x and 7?
cause default all files and folders located @ /var/www/ are all owned by root
generated by apache(from base) of centOS

Owner

RainLoop commented Jul 31, 2014

Please, run this code in RainLoop Webmail root folder.

check.php

<?php

define('APP_DATA_FOLDER_PATH', './data/');

$sCheckName = 'delete_if_you_see_it_after_install';
$sCheckFolder = APP_DATA_FOLDER_PATH.$sCheckName;
$sCheckFilePath = APP_DATA_FOLDER_PATH.$sCheckName.'/'.$sCheckName.'.file';

@unlink($sCheckFilePath);
@rmdir($sCheckFolder);

$aResult = array();
if (is_dir(APP_DATA_FOLDER_PATH))
{
    $aResult = array(
        '1) is_dir='.(@is_dir(APP_DATA_FOLDER_PATH) ? '1' : '0'),
        '2) is_readable='.(@is_readable(APP_DATA_FOLDER_PATH) ? '1' : '0'),
        '3) is_writable='.(@is_writable(APP_DATA_FOLDER_PATH) ? '1' : '0'),
        '4) mkdir='.(@mkdir($sCheckFolder, 0755) ? '1' : '0'),
        '5) file_put_contents='.(false !== @file_put_contents($sCheckFilePath, time()) ? '1' : '0'),
        '6) unlink='.(false !== @unlink($sCheckFilePath) ? '1' : '0'),
        '7) rmdir='.(false !== @rmdir($sCheckFolder) ? '1' : '0')
    );
}
else
{
    $aResult[] = 'is_dir=0';
}

echo implode("</br>\r\n", $aResult);
?>

@RainLoop

1) is_dir=1
2) is_readable=1
3) is_writable=0
4) mkdir=0
5) file_put_contents=0
6) unlink=0
7) rmdir=0
Owner

RainLoop commented Jul 31, 2014

Your data folder is not writable from PHP code. Try to set correct chown for data folder (your webserver user - apache, www-data or nginx)

MrKeiKun commented Aug 1, 2014

@RainLoop

I already 777 everything
still not working

can you give me a code
that will write something inside data?
cause i don't think data isn't writeable

Owner

RainLoop commented Aug 1, 2014

I already gave you the code.
He tried to write files in the data folder.

MrKeiKun commented Aug 1, 2014

@RainLoop

so 1-7 should be is equal to 1
that is just over /data/ right?

Owner

RainLoop commented Aug 1, 2014

Yes

Owner

RainLoop commented Aug 14, 2014

Is this issue still relevant?

Selinux issue~
@RainLoop
Documentation should tell to disable Selinux~

@MrKeiKun MrKeiKun closed this Aug 15, 2014

Owner

RainLoop commented Aug 15, 2014

Ok, thanks!

jedufa commented Jan 5, 2015

i had the same problem. 777 worked.

Boycce commented Feb 19, 2015

Same had to change chmod to 777

galch99 commented May 12, 2015

@RainLoop

  1. is_dir=1
  2. is_readable=1
  3. is_writable=1
  4. mkdir=1
  5. file_put_contents=0
  6. unlink=0
  7. rmdir=1

every thing 777. but not working :(

rjapeer commented Dec 31, 2015

Took me a little while to figure out, but the solution is to have SE Linux allow writing data folder by httpd:
You need to change the label on '/your/installation/folder/data'.
In my case this is done by the following two commands (as root user):

[root@machine rainloop]# cd /var/www/html/rainloop
[root@machine rainloop]# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/rainloop/data'
[root@machine rainloop]# restorecon -v '/var/www/html/rainloop/data'

Note that the complete path to the rainloop data folder must be specified.
You can check the setting using ls -Z:

[root@machine rainloop]# ls -Z
drwxr-xr-x. apache apache system_u:object_r:httpd_sys_rw_content_t:s0 data
-rw-r--r--. apache apache system_u:object_r:httpd_sys_content_t:s0 index.php
drwxr-xr-x. apache apache system_u:object_r:httpd_sys_content_t:s0 rainloop

And with the check.php script from a previous comment the output should be:

1) is_dir=1
2) is_readable=1
3) is_writable=1
4) mkdir=1
5) file_put_contents=1
6) unlink=1
7) rmdir=1

[202] Data folder permissions error [is_writable]. i have SSH console. how do i make this run?

following the doc has worked for me :

http://www.rainloop.net/docs/permissions/

maybe it was the missing : chown -R www-data:www-data .

not worked.

i have

  1. is_dir=1
  2. is_readable=1
  3. is_writable=1
  4. mkdir=1
  5. file_put_contents=0
  6. unlink=0
  7. rmdir=1

chmod = 0777

but i dont have ssh access

what should i do?

mpatron commented Jun 25, 2016

You should try

setsebool httpd_unified true
setsebool httpd_can_network_connect true
yum install policycoreutils-python
cd /var/www/html/rainloop
semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/rainloop/data'
restorecon -v '/var/www/html/rainloop/data'
systemctl restart httpd

It is working for me on my centos7+rainloop.

@DevSidious DevSidious referenced this issue in pierre-alain-b/rainloop-nextcloud Mar 19, 2017

Closed

Nextcloud 11.0.2 : [202] Data folder permissions error [is_dir] #7

parsibox commented Jul 4, 2017

you should desable selinux and reboot your os

For Windows + IIS you have to give proper permissions to IUSR also

I had the same problem with SELinux off and correct permissions (644 for files and 755 for directories).
I needed to change php-fpm user to the same user as web server (e.g. nginx, www-data, ...)

here is what I changed in /etc/php-fpm.d/www.conf in CentOS 7:

listen.owner = nobody
listen.group = nobody
user = nginx
group = nginx

and then sudo systemctl restart php-fpm solved the problem

mojili commented Aug 7, 2017

I had the same problem with SELinux. first setenforce 0 and then try if everything is ok, then enable SELinux setenforce 1 and try to find the targets witch SELinux denies them .
Tail -f /var/log/audit/audit.log | grep deny
then with semanage or other tools set the proper permission.

hi , i had the same problem ;

  1. is_dir=
  2. is_readable=1
  3. is_writable=1
  4. mkdir=1
  5. file_put_contents=1
  6. unlink=1
  7. rmdir=1
    Selinux disable

but : [202] Data folder permisions error

os: centos 5.11 / apache 2.2.31

mpatron commented Oct 20, 2017

shaahinhs , you should follow pierre-alain-b/rainloop-nextcloud#7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment