I have nc 18.0.3 and in my log file is this error:
Error PHP unlink(/media/fc_daten/data_dir_writability_test_5e917e11288cc.tmp): No such file or directory at /var/www/html/cloud/lib/private/legacy/util.php#807
It seems that you’re trying to access data on a drive (/media/fc_daten) which isn’t accessible by Nextcloud, because it tries to delete a non existent file (unlink). Due to the fact that it doesn’t exist, it most likely wasn’t possible to create the test file in advance.
All resources need to be accessible by the web server user, e.g. www-data oder wwwrun, etc.
Still I have set all folder and files to www-data: chown -R www-data:www-data /media/fc_daten
But allways I get the error in the log file:
Error PHP unlink(/media/fc_daten/data_dir_writability_test_5e946fcc89438.tmp): No such file or directory at /var/www/html/cloud/lib/private/legacy/util.php#807
2020-04-13T15:57:32+0200
Error PHP unlink(/media/fc_daten/data_dir_writability_test_5e9469936ce98.tmp): No such file or directory at /var/www/html/cloud/lib/private/legacy/util.php#807
2020-04-13T15:30:59+0200
Error PHP unlink(/media/fc_daten/data_dir_writability_test_5e94634d0505a.tmp): No such file or directory at /var/www/html/cloud/lib/private/legacy/util.php#807
2020-04-13T15:04:13+0200
Error PHP unlink(/media/fc_daten/data_dir_writability_test_5e9460c7e46bf.tmp): No such file or directory at /var/www/html/cloud/lib/private/legacy/util.php#807
Based on your output delete rights seem still to be missing. Instead of using ls as root user to display the access rights, have you tried to switch to the user “www-data”, navigate to the mentioned directory and tried to delete one of the .tmp files?
I have googled, but I can’t find the right way to switch to the user www-data
I have ubuntu 18.04
Can you write me, how can I switch to the user www-data?
if ($config->getValue('installed', false)) {
if (!is_dir($CONFIG_DATADIRECTORY)) {
$success = @mkdir($CONFIG_DATADIRECTORY);
if ($success) {
$errors = array_merge($errors, self::checkDataDirectoryPermissions($CONFIG_DATADIRECTORY));
} else {
$errors[] = [
'error' => $l->t('Cannot create "data" directory'),
'hint' => $l->t('This can usually be fixed by giving the webserver write access to the root directory. See %s',
[$urlGenerator->linkToDocs('admin-dir_permissions')])
];
}
} else if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
// is_writable doesn't work for NFS mounts, so try to write a file and check if it exists.
$testFile = sprintf('%s/%s.tmp', $CONFIG_DATADIRECTORY, uniqid('data_dir_writability_test_'));
$handle = fopen($testFile, 'w');
if (!$handle || fwrite($handle, 'Test write operation') === FALSE) {
$permissionsHint = $l->t('Permissions can usually be fixed by giving the webserver write access to the root directory. $
[$urlGenerator->linkToDocs('admin-dir_permissions')]);
$errors[] = [
'error' => 'Your data directory is not writable',
'hint' => $permissionsHint
];
} else {
fclose($handle);
unlink($testFile);
}
The line 807 is the last "unlink($testFile);
How can I check the part of the code to see what the error is?
Thanks!