Elfinder: Chmod function always disabled

Created on 31 Dec 2019  路  5Comments  路  Source: Studio-42/elFinder

I can't figure out why the chmod button is always disabled for me. I have enabled the button, but when I select a file, it's always greyed-out, as shown here.

Screen Shot 2019-12-31 at 1 11 42 PM

I have enabled the chmod command in my connector config by adding:

'allowChmodReadOnly' => TRUE,
'statOwner'     => TRUE,

That makes the button show up, but it's always disabled. The statOwner function is working, and I have the permission shown in Get Info.

Screen Shot 2019-12-31 at 1 16 41 PM

I must be missing a step. Any ideas?

question

Most helpful comment

Ugh. Sorry. php-posix module was not installed.

I thought it was because --enable-posix=shared was on the configure command info in phpinfo(). But, apparently on Alpine Linux, you also need to have php7-posix package installed. After I install, it works.

Thanks again for your help debugging this.

All 5 comments

I should have mentioned this is on LocalFileSystem driver.

@zengenuity Is the execution account of php (Web server) UID 2000? chmod can only be a file whose owner is php (Web server).

Thanks for your help with this.

Yes, UID 2000 is a user account "dev". Some debugging output from the command line:

Dev is UID 2000:

dev@studentdru1:~/data$ id
uid=2000(dev) gid=2000(dev) groups=2000(dev)

Dev owns the file and has write access.

dev@studentdru1:~/data$ ls -l
total 0
-rw-r--r--    1 dev      dev              0 Dec 31 18:01 NewFile.php

PHP is running as mod-php on Apache. Apache is running as user dev:

dev@studentdru1:~/data$ ps ax
PID   USER     TIME  COMMAND
...
 1935 dev       0:00 /usr/sbin/httpd -d /var/www -f /etc/apache2/httpd.conf -k start
 1936 dev       0:00 /usr/sbin/httpd -d /var/www -f /etc/apache2/httpd.conf -k start

The file NewFile.php was actually created using elFinder, and it was created owned by dev, so that matches with the web server user.

Dev user can run chmod on the command line, and it works:

dev@studentdru1:~/data$ ls -l
total 0
-rw-r--r--    1 dev      dev              0 Dec 31 18:01 NewFile.php
dev@studentdru1:~/data$ chmod 755 NewFile.php
dev@studentdru1:~/data$ ls -l
total 0
-rwxr-xr-x    1 dev      dev              0 Dec 31 18:01 NewFile.php
dev@studentdru1:~/data$

Anything else I should check?

elFinder use posix_getuid() to get PHP uid. What is result next test code on your web server?

```php
var_dump(posix_getuid());

Ugh. Sorry. php-posix module was not installed.

I thought it was because --enable-posix=shared was on the configure command info in phpinfo(). But, apparently on Alpine Linux, you also need to have php7-posix package installed. After I install, it works.

Thanks again for your help debugging this.

Was this page helpful?
0 / 5 - 0 ratings