Permission problem: Setting Strong Directory Permissions
Steps to reproduce
- Check - 4.3.5 Setting Strong Directory Permissions from Administrator manual
- Everything is fine there (on page 18), but need to add one additional command:
$ chown -R ${htuser}:${htgroup} ${ocpath}/assets/ (chmod's should remain as mentioned, no extra rights needed, so folder assets should have 0750 and all files within that folder 0640)
Why? Check below.
Expected behaviour
After enabling the following option in config.php - 'asset-pipeline.enabled' => true, owncloud should be able to write in assets folder.
Actual behaviour
Owncloud is not able to write in assets folder, thus is producing the error mentioned below (owncloud.log). After changing owner on the folder, errors were gone on next cron job.
Server configuration
Operating system: Debian 8
Web server: Apache
Database: MariaDB
PHP version: 5.6.12
ownCloud version: (see ownCloud admin page) 8.1.1
Updated from an older ownCloud or fresh install: fresh install
List of activated apps: Enabled:
- activity: 2.0.1
- files: 1.1.10
- files_antivirus: 0.7.0.1
- files_locking:
- files_pdfviewer: 0.7
- files_sharing: 0.6.2
- files_texteditor: 0.4
- files_trashbin: 0.6.3
- files_versions: 1.0.6
- files_videoviewer: 0.1.3
- firstrunwizard: 1.1
- gallery: 0.6.0
- provisioning_api: 0.2
- templateeditor: 0.1
If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your ownCloud installation folder
The content of config/config.php:
If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system --public
from within your ownCloud installation folder
(side note)
$ sudo -u www-data php occ config:list system --public
[InvalidArgumentException]
There are no commands defined in the "config" namespace.
or
Insert your config.php content here
(Without the database password, passwordsalt and secret)
'',
'passwordsalt' => '',
'secret' => '',
'trusted_domains' =>
array (
0 => 'XX',
),
'datadirectory' => '/opt/owncloud/data',
'overwrite.cli.url' => 'XX',
'dbtype' => 'mysql',
'version' => '8.1.1.3',
'dbname' => 'XX',
'dbhost' => 'localhost',
'dbtableprefix' => 'oc_',
'dbuser' => 'XX',
'dbpassword' => 'XX',
'logtimezone' => 'UTC',
'installed' => true,
'loglevel' => 2,
'asset-pipeline.enabled' => true,
'memcache.local' => '\OC\Memcache\APCu',
'defaultapp' => 'files',
'theme' => '',
'maintenance' => false,
'mail_smtpmode' => 'php',
'mail_smtpauth' => 1,
'mail_smtpsecure' => 'ssl',
'appstore.experimental.enabled' => false,
'singleuser' => false,
'knowledgebaseenabled' => false,
'check_for_working_htaccess' => false,
'log_rotate_size' => 104857600,
);
**Are you using external storage, if yes which one:** local/smb/sftp/... - no external storage
**Are you using encryption:** no
**Are you using an external user-backend, if yes which one:** LDAP/ActiveDirectory/Webdav/... - no external user-backend
### Client configuration
**Browser:** Mozilla Firefox
**Operating system:** Ubuntu 14.04 LTS
### Logs
#### ownCloud log (data/owncloud.log)
```
Insert your ownCloud log here
```
Error assets Folder could not be accessed. 2015-09-02T07:43:25+00:00
Error PHP touch(): Unable to create file /var/www/owncloud/assets/.oc because Permission denied at /var/www/owncloud/lib/private/template.php#265 2015-09-02T07:43:25+00:00
Let me know if you need anything else!
If your web server has write access to your ownCloud installation, then the ‘assets’ folder will be automatically created for you, otherwise, you need to create it yourself before enabling that option and you must give write access to your web server user.
https://doc.owncloud.org/server/8.2/admin_manual/configuration_server/js_css_asset_management_configuration.html
Still an issue. On upgrade, if you use suggested script in 4.3.5 Setting Strong Directory Permissions from Administrator manual it will change the permissions on the directory back to root (including the hidden .oc file, which while it seems like a good idea is horrible from a debugging perspective until you read the code.)
@lexpierce You are using a script designed for production environments and complaining it breaks your debug environment?
This is production, it is first time for an upgrade (8.2 -> 8.2.1) since the enabling of asset pipelining. My primary complaint is the fact that even after removing existing assets and changing permissions on the directoy, it still wouldn't work due to a hidden file (.oc) that existed but had wrong ownership. It was a bit frustrating. There has to be a more robust or easily documented way of testing the writability of a directory that touching a hidden file. is_writable() perhaps?
cc @carlaschroder
@Xenopathic Not sure about adding the assets dir to the permissions script-- I'd like more review, please. @MorrisJobke @LukasReschke
Any news on this issue? I had the same log after enabling asset pipelining and followed this documentation: https://doc.owncloud.org/server/8.2/admin_manual/installation/installation_wizard.html#strong-perms-label
Solved after having changed the permission of this folder, but not sure about the consequences. @carlaschroder , did you get more review?
@MorrisJobke @LukasReschke @DeepDiver1975 ?
We recommend using asset pipelining to improve performance https://doc.owncloud.org/server/9.0/admin_manual/configuration_server/performance_tuning/oc_server_tuning.html?highlight=asset#enable-javascript-and-css-asset-management
I understand that, that's why I enabled it. But the script mentionned here (https://doc.owncloud.org/server/8.2/admin_manual/installation/installation_wizard.html#strong-perms-label) doesn't allow this, because it sets write permission to root instead of web server to the assets folder.
There should be minimum a warning at the top of the administration page, and/or a change in the script.
@etiess, sorry, the comment about asset pipelining is directed at the people I asked to review this. It's not good to recommend things that don't work :)
I understand that, that's why I enabled it. But the script mentionned here (https://doc.owncloud.org/server/8.2/admin_manual/installation/installation_wizard.html#strong-perms-label) doesn't allow this, because it sets write permission to root instead of web server to the assets folder.
Correct. The folder assets should also be allowed to be written to. @carlaschroder
We recommend using asset pipelining to improve performance https://doc.owncloud.org/server/9.0/admin_manual/configuration_server/performance_tuning/oc_server_tuning.html?highlight=asset#enable-javascript-and-css-asset-management
The performance is questionable. Because request wise I doubt that it is better, because stuff is bundled all together instead "per app".
The performance is questionable. Because request wise I doubt that it is better, because stuff is bundled all together instead "per app".
Yup: https://github.com/owncloud/core/issues/17693
ok thanks everyone! I shall fix it.
Any update ? What's the next step ? Is this still an issue with 8.2.2 / 9.0 RC1 ?
The documentation appears to have been updated. I'd say we are good here.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.