Probleme mit Upload und Verzeichnisberechtigung

Hallo,
ich habe ein Problem seit dem Upgrade auf Nextcloud 21.

  1. Wenn ich über die Nextcloud Android-App 3.15.1 eine größere Datei hochladen möchte, dann bekomme ich einen Fehler. In den Logs konnte ich Zugriffsberechtigungen sehen. Das Problem tritt im uploads-Verzeichnis meines Benutzters auf.
  2. Prinzipiell werden dort Verzeichnisse für den Upload angelegt. Die Berechtigungen stehen dafür auf 0755. Wenn ich die Berechtigung dann auf 0775 ändere und die fehlerhaften Uploads nochmal starte, funktionert alles.

root@MINIX1:/var/share/owncloud/data/MeisterChang/uploads# ls -l
insgesamt 0
drwxr-xr-x 2 www-data www-data 0 Mai 2 15:05 9c115faa547f9f10a935c475706a3b3f
drwxr-xr-x 2 www-data www-data 0 Mai 2 15:05 bb144759e180689e780b781a9f348560
drwxr-xr-x 2 www-data www-data 0 Mai 2 15:05 c21493a6237fd1a04c8eabb9f28daaca

{“reqId”:“xrZGfgGuVR3puKNyw30f”,“level”:3,“time”:“2021-04-26T20:31:14+00:00”,“remoteAddr”:“192.168.1.21”,“user”:“MeisterChang”,“app”:“PHP”,“method”:“PUT”,“url”:"/remote.php/dav/uploads/MeisterChang/d8ed6583c765756b7d5b35eff303b7c9/0000000000000000-0000000002265672",“message”:{“Exception”:“Error”,“Message”:“rename(//var/share/owncloud/data/MeisterChang/uploads/cc6d74e5e86b4b7c279247351336fd63.ocTransferId362618216.part,//var/share/owncloud/data/MeisterChang/uploads/d8ed6583c765756b7d5b35eff303b7c9/0000000000000000-0000000002265672): Permission denied at /var/www/nextcloud/lib/private/Files/Storage/Local.php#341”,“Code”:0,“Trace”:[{“function”:“onError”,“class”:“OC\Log\ErrorHandler”,“type”:"::"},{“file”:"/var/www/nextcloud/lib/private/Files/Storage/Local.php",“line”:341,“function”:“rename”},{“file”:"/var/www/nextcloud/lib/private/Files/Storage/Local.php",“line”:551,“function”:“rename”,“class”:“OC\Files\Storage\Local”,“type”:"->"},{“file”:"/var/www/nextcloud/apps/files_trashbin/lib/Storage.php",“line”:240,“function”:“moveFromStorage”,“class”:“OC\Files\Storage\Local”,“type”:"->"},{“file”:"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php",“line”:292,“function”:“moveFromStorage”,“class”:“OCA\Files_Trashbin\Storage”,“type”:"->"},{“file”:"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php",“line”:156,“function”:“put”,“class”:“OCA\DAV\Connector\Sabre\File”,“type”:"->"},{“file”:"/var/www/nextcloud/apps/dav/lib/Upload/UploadFolder.php",“line”:46,“function”:“createFile”,“class”:“OCA\DAV\Connector\Sabre\Directory”,“type”:"->"},{“file”:"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",“line”:1098,“function”:“createFile”,“class”:“OCA\DAV\Upload\UploadFolder”,“type”:"->"},{“file”:"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php",“line”:504,“function”:“createFile”,“class”:“Sabre\DAV\Server”,“type”:"->"},{“file”:"/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",“line”:89,“function”:“httpPut”,“class”:“Sabre\DAV\CorePlugin”,“type”:"->"},{“file”:"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",“line”:472,“function”:“emit”,“class”:“Sabre\DAV\Server”,“type”:"->"},{“file”:"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",“line”:253,“function”:“invokeMethod”,“class”:“Sabre\DAV\Server”,“type”:"->"},{“file”:"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php",“line”:321,“function”:“start”,“class”:“Sabre\DAV\Server”,“type”:"->"},{“file”:"/var/www/nextcloud/apps/dav/lib/Server.php",“line”:332,“function”:“exec”,“class”:“Sabre\DAV\Server”,“type”:"->"},{“file”:"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php",“line”:35,“function”:“exec”,“class”:“OCA\DAV\Server”,“type”:"->"},{“file”:"/var/www/nextcloud/remote.php",“line”:167,“args”:["/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"],“function”:“require_once”}],“File”:"/var/www/nextcloud/lib/private/Log/ErrorHandler.php",“Line”:92,“CustomMessage”:"–"},“userAgent”:“Mozilla/5.0 (Android) Nextcloud-android/3.15.1”,“version”:“21.0.1.1”}

root@MINIX1:/var/share/owncloud/data/MeisterChang/uploads# chmod g+w *
root@MINIX1:/var/share/owncloud/data/MeisterChang/uploads# ls -l
insgesamt 0
drwxrwxr-x 2 www-data www-data 0 Mai 2 15:05 9c115faa547f9f10a935c475706a3b3f
drwxrwxr-x 2 www-data www-data 0 Mai 2 15:05 bb144759e180689e780b781a9f348560
drwxrwxr-x 2 www-data www-data 0 Mai 2 15:05 c21493a6237fd1a04c8eabb9f28daaca
root@MINIX1:/var/share/owncloud/data/MeisterChang/uploads# ls -l
insgesamt 0

Folgendes habe ich schon versucht:

  1. umask 0002 für den Benutzer www-data. Leider hat es bei der Verzeichnisanlage keine Auswirkung.
  2. In einer Testnextcloud funktinoiert es.

Hintergrund:
Die Nextcloud betreibe ich auf Ubuntu 20. Das Nextcloud Datenverzeichnis liegt auf einer Buffalo Link Station und wir mit Samba eingebunden.
fstab:
//192.168.1.12/minix1/Nextcloud /var/share/owncloud cifs vers=1.0,credentials=/home/minix/.smbcredentials_nas_minix,uid=33,gid=33,file_mode=0660,dir_mode=0770 0 0

Systeminformationen:

  • Lokal auf einem Minix mit Ubuntu 20 LTS Linux 5.4.0-72-generic.
  • Upload von Android 11 Galaxy S10.
  • Nextcloud 21.0.1
  • PHP 7.4
  • Apache/2.4.41 (Ubuntu)
  • mysql 10.5.5
  • Kein Docker, kein Snap, keine VM

Nextcloud config.php:

<?php $CONFIG = array ( 'instanceid' => 'xxx', 'passwordsalt' => 'xxx', 'secret' => 'xxx', 'trusted_domains' => array ( 1 => 'xxx', ), 'datadirectory' => '/var/share/owncloud/data', 'overwrite.cli.url' => 'xxx', 'htaccess.RewriteBase' => '/', 'dbtype' => 'mysql', 'version' => '21.0.1.1', 'dbname' => 'nextcloud', 'dbhost' => 'localhost', 'dbtableprefix' => 'oc_', 'dbuser' => 'xxx', 'dbpassword' => 'xxx', 'logtimezone' => 'UTC', 'installed' => true, 'forcercessl' => true, 'enable_previews' => true, 'preview_max_x' => 1024, 'preview_max_y' => 1024, 'preview_libreoffice_path' => '/usr/bin/libreoffice', 'preview_office_cl_parameters' => ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to png --outdir ', 'enabledPreviewProviders' => array ( 0 => 'OC\\Preview\\PNG', 1 => 'OC\\Preview\\JPEG', 2 => 'OC\\Preview\\GIF', 3 => 'OC\\Preview\\PDF', 4 => 'OC\\Preview\\HEIC', 5 => 'OC\\Preview\\BMP', 6 => 'OC\\Preview\\XBitmap', 7 => 'OC\\Preview\\MP3', 8 => 'OC\\Preview\\TXT', 9 => 'OC\\Preview\\MarkDown', 10 => 'OC\\Preview\\Movie', 11 => 'OC\\Preview\\Font', 12 => 'OC\\Preview\\SVG', 13 => 'OC\\Preview\\TIFF', ), 'loglevel' => 3, 'log_rotate_size' => 104857600, 'memcache.local' => '\\OC\\Memcache\\Redis', 'redis' => array ( 'host' => 'localhost', 'port' => 6379, ), 'memcache.locking' => '\\OC\\Memcache\\Redis', 'trashbin_retention_obligation' => 'auto', 'theme' => '', 'maintenance' => false, 'mail_smtpmode' => 'sendmail', 'mail_from_address' => 'xxx', 'mail_domain' => 'xxx', 'asset-pipeline.enabled' => false, 'enable_certificate_management' => true, 'defaultapp' => 'calendar,files', 'activity_expire_days' => 10, 'mail_smtpsecure' => 'ssl', 'mail_smtphost' => 'xxx', 'mail_smtpport' => '465', 'mail_smtpauthtype' => 'LOGIN', 'mail_smtpauth' => 1, 'updater.release.channel' => 'stable', 'mysql.utf8mb4' => true, 'twofactor_enforced' => 'true', 'twofactor_enforced_groups' => array ( ), 'twofactor_enforced_excluded_groups' => array ( ), 'app_install_overwrite' => array ( 0 => 'keeweb', 1 => 'audioplayer', 2 => 'ocr', ), 'encryption.legacy_format_support' => false, 'encryption.key_storage_migrated' => false, 'skeletondirectory' => '/var/share/owncloud/skeleton', 'knowledgebaseenabled' => true, 'default_phone_region' => 'DE', 'part_file_in_storage' => true, ); Ich hoffe, dass Ihr mir helfen könnt. Danke schon mal.

Hi @MeisterChang

drei Rückfragen kann ich mir nach Lektüre deiner Fehlermeldungen aus der Nase ziehen :slight_smile:

  • uid=33,gid=33 - wer ist das?
  • Wie läuft PHP? Als Apache-Modul oder FPM?
  • Unter welchen Nutzer läuft PHP? Wenn es www-data ist, sollte 0755 und 0775 equivalent sein.

/S

Hallo simonspa,
danke für die schnelle Bearbeitung. Das Problem habe ich heute fixen können. Ich kann aber nur raten, wie es dazu kam.
Die Cloud benutze ich schon seit jahren. Das was sich geändert hat, war ein Systemupdate von Ubuntu und von Nextcloud auf 21. Ich vermute nun, dass sich etwas bei SMB geändert hat.
Bisher hatte ich in der fstab fix auf Version 1 des SMB-Protokolls eingeschränkt. Das habe ich nun entfernt. Somit wird jetzt version 2 verwendet und meine Probleme sind behoben. Warum das so ist, kann ich leider nicht sagen.
Trotzdem möchte ich Deine Fragen noch beantworten:

  1. UID und GID sind beide www-data
  2. PHP läuft als Apache-Modul
  3. PHP läuft mit www-data und danke für den Hinweis!
    Danke

Na, na, na. Wer redet hier denn von “Bearbeitung” - das klingt ja so als ob ich dafür bezahlt werde…
Gerne doch habe ich in meiner Freizeit versucht, einem anderen NC-Bastler weiter zu helfen. :slight_smile:

/S