Nextcloud version: 22.1.1
Operating system and version: Rocky Linux 8.4 (basically centos8/rhel8)
Apache or nginx version: Apache/2.4.37 (rocky)
PHP version: PHP 7.4.23
Hello!
The issue I am facing:
After successfully connecting an SMB share to Nextcloud trough the admin settings in the web interface, files can only be read.
I have made sure that the user used to authenticate to the SMB share has full permissions to folder, subfolders and files (on the windows end). Edit: see solution, problem was with share set up…
Is this the first time you’ve seen this error? (Y/N): YES (Found some threads with people on earlier versions failing to connect to SMB, but they do not seem relevant in my case since I can read from the share, just not write to.)
Steps to replicate it:
- Create an SMB share on windows server 2019
- Create a dummy user on the server, and give the account and its group full permissions to the share.
- Connect to the share through the admin settings in Nextcloud web interface.
- Share is connected and files can be read, albeit video playback is very slow…
- Try to create file in the share (or move to) = fail.
Tried from the web interface and android app.
(Not super relevant but I used the workaround mentioned here to allow ffmpeg to generate previews. Does not seem to affect the problem)
The output of my Nextcloud log in Admin > Logging:
Trying to create a textfile:
{"reqId":"YT-JM4Vq64XHah7zWsMNzwAAAMk","level":3,"time":"2021-09-13T23:57:07+02:00","remoteAddr":"192.168.1.1","user":"AnAdmin","app":"no app in context","method":"POST","url":"/ocs/v2.php/apps/files/api/v1/templates/create","message":"Could not create path","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0","version":"22.1.1.2","exception":{"Exception":"OCP\\Files\\NotPermittedException","Message":"Could not create path","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/lib/private/Files/Template/TemplateManager.php","line":162,"function":"newFile","class":"OC\\Files\\Node\\Folder","type":"->"},{"file":"/var/www/html/nextcloud/apps/files/lib/Controller/TemplateController.php","line":57,"function":"createFromTemplate","class":"OC\\Files\\Template\\TemplateManager","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":217,"function":"create","class":"OCA\\Files\\Controller\\TemplateController","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":126,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":156,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Route/Router.php","line":301,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/html/nextcloud/ocs/v1.php","line":62,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/nextcloud/ocs/v2.php","line":23,"args":["/var/www/html/nextcloud/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/html/nextcloud/lib/private/Files/Node/Folder.php","Line":203,"CustomMessage":"Could not create path"},"id":"613fcb56b4869"}
Trying to move a file to the share:
#Sorted oldest first
{"reqId":"YT-MOX1vDVBR3tDTr3nwggAAAEk","level":2,"time":"2021-09-14T00:10:02+02:00","remoteAddr":"192.168.1.1","user":"Rinkana","app":"no app in context","method":"COPY","url":"/remote.php/dav/files/Rinkana/HEJ/HOW%20TO.md","message":"Failed to copy stream to storage","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0","version":"22.1.1.2","exception":{"Exception":"OCP\\Files\\GenericFileException","Message":"Failed to open HOW TO.md for writing","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/lib/private/Files/Storage/Common.php","line":626,"function":"writeStream","class":"OC\\Files\\Storage\\Common","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":562,"function":"copyFromStorage","class":"OC\\Files\\Storage\\Common","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php","line":423,"function":"copyFromStorage","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":562,"function":"copyFromStorage","class":"OC\\Files\\Storage\\Wrapper\\Availability","type":"->"},{"file":"/var/www/html/nextcloud/apps/files_accesscontrol/lib/StorageWrapper.php","line":295,"function":"copyFromStorage","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/View.php","line":940,"function":"copyFromStorage","class":"OCA\\FilesAccessControl\\StorageWrapper","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":473,"function":"copy","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":132,"function":"copyInto","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":655,"function":"copy","class":"Sabre\\DAV\\Tree","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpCopy","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/lib/Server.php","line":333,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/remote.php","line":166,"args":["/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/nextcloud/lib/private/Files/Storage/Common.php","Line":863,"CustomMessage":"Failed to copy stream to storage"},"id":"613fcc416b89b"}
{"reqId":"YT-MOX1vDVBR3tDTr3nwggAAAEk","level":3,"time":"2021-09-14T00:10:02+02:00","remoteAddr":"192.168.1.1","user":"Rinkana","app":"no app in context","method":"COPY","url":"/remote.php/dav/files/Rinkana/HEJ/HOW%20TO.md","message":"Error while copying file to target location (copied bytes: -1, expected filesize: -1 )","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0","version":"22.1.1.2","exception":{"Exception":"Sabre\\DAV\\Exception","Message":"Error while copying file to target location (copied bytes: -1, expected filesize: -1 )","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":155,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":307,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":133,"function":"copyNode","class":"Sabre\\DAV\\Tree","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":655,"function":"copy","class":"Sabre\\DAV\\Tree","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpCopy","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/lib/Server.php","line":333,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/remote.php","line":166,"args":["/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/File.php","Line":235,"CustomMessage":"--"},"id":"613fcc416b846"}
{"reqId":"YT-MOX1vDVBR3tDTr3nwggAAAEk","level":4,"time":"2021-09-14T00:10:02+02:00","remoteAddr":"192.168.1.1","user":"Rinkana","app":"webdav","method":"COPY","url":"/remote.php/dav/files/Rinkana/HEJ/HOW%20TO.md","message":"Error while copying file to target location (copied bytes: -1, expected filesize: -1 )","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0","version":"22.1.1.2","exception":{"Exception":"Sabre\\DAV\\Exception","Message":"Error while copying file to target location (copied bytes: -1, expected filesize: -1 )","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":155,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":307,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":133,"function":"copyNode","class":"Sabre\\DAV\\Tree","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":655,"function":"copy","class":"Sabre\\DAV\\Tree","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpCopy","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/lib/Server.php","line":333,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/remote.php","line":166,"args":["/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/File.php","Line":235,"CustomMessage":"--"},"id":"613fcc416b807"}
Trying to rename a file:
{"reqId":"YT-TBIVq64XHah7zWsMOjQAAAMc","level":2,"time":"2021-09-14T00:39:00+02:00","remoteAddr":"192.168.1.1","user":"AnAdmin","app":"no app in context","method":"MOVE","url":"/remote.php/dav/files/AnAdmin/SMB/videofile.mp4","message":"Invalid request for /hmmmm.mp4 (ForbiddenException)","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0","version":"22.1.1.2","exception":{"Exception":"Icewind\\SMB\\Exception\\ForbiddenException","Message":"Invalid request for /hmmmm.mp4 (ForbiddenException)","Code":13,"Trace":[{"file":"/var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php","line":67,"function":"fromMap","class":"Icewind\\SMB\\Exception\\Exception","type":"::"},{"file":"/var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php","line":84,"function":"handleError","class":"Icewind\\SMB\\Native\\NativeState","type":"->"},{"file":"/var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeState.php","line":165,"function":"testResult","class":"Icewind\\SMB\\Native\\NativeState","type":"->"},{"file":"/var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Native/NativeShare.php","line":186,"function":"rename","class":"Icewind\\SMB\\Native\\NativeState","type":"->"},{"file":"/var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php","line":314,"function":"rename","class":"Icewind\\SMB\\Native\\NativeShare","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":279,"function":"rename","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php","line":294,"function":"rename","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":279,"function":"rename","class":"OC\\Files\\Storage\\Wrapper\\Availability","type":"->"},{"file":"/var/www/html/nextcloud/apps/files_accesscontrol/lib/StorageWrapper.php","line":209,"function":"rename","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/View.php","line":826,"function":"rename","class":"OCA\\FilesAccessControl\\StorageWrapper","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/Node.php","line":140,"function":"rename","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":153,"function":"setName","class":"OCA\\DAV\\Connector\\Sabre\\Node","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":612,"function":"move","class":"Sabre\\DAV\\Tree","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpMove","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/lib/Server.php","line":333,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/remote.php","line":166,"args":["/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Exception/Exception.php","Line":44,"CustomMessage":"--"},"id":"613fd30d91b90"}
{"reqId":"YT-TBIVq64XHah7zWsMOjQAAAMc","level":4,"time":"2021-09-14T00:39:00+02:00","remoteAddr":"192.168.1.1","user":"AnAdmin","app":"webdav","method":"MOVE","url":"/remote.php/dav/files/AnAdmin/SMB/videofile.mp4","message":"Failed to rename /SMB/videofile.mp4 to /SMB/hmmmm.mp4","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0","version":"22.1.1.2","exception":{"Exception":"Sabre\\DAV\\Exception","Message":"Failed to rename /SMB/videofile.mp4 to /SMB/hmmmm.mp4","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":153,"function":"setName","class":"OCA\\DAV\\Connector\\Sabre\\Node","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":612,"function":"move","class":"Sabre\\DAV\\Tree","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpMove","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/lib/Server.php","line":333,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/html/nextcloud/remote.php","line":166,"args":["/var/www/html/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/nextcloud/apps/dav/lib/Connector/Sabre/Node.php","Line":141,"CustomMessage":"--"},"id":"613fd30d91b21"}
The output of my config.php file (some information replaced with xxx):
<?php
$CONFIG = array (
'instanceid' => 'xxx',
'passwordsalt' => 'xxx',
'secret' => 'xxx',
'trusted_domains' =>
array (
0 => 'xxx',
1 => 'xxx',
2 => 'xxx',
),
'datadirectory' => '/opt/datastor/nc_data/',
'dbtype' => 'mysql',
'version' => '22.1.1.2',
'overwrite.cli.url' => 'xxx',
'dbname' => 'nextcloud',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'xxx',
'dbpassword' => 'xxx',
'installed' => true,
'log_type' => 'file',
'loglevel' => 2,
'logtimezone' => 'xxx',
'default_phone_region' => 'xx',
'default_language' => 'xx',
'default_locale' => 'xx',
'skeletondirectory' => '/var/www/html/nextcloud/custom-skeleton',
'templatedirectory' => '/var/www/html/nextcloud/custom-templates',
'enabledPreviewProviders' =>
array (
0 => 'OC\\Preview\\PNG',
1 => 'OC\\Preview\\JPEG',
2 => 'OC\\Preview\\GIF',
3 => 'OC\\Preview\\BMP',
4 => 'OC\\Preview\\XBitmap',
5 => 'OC\\Preview\\MP3',
6 => 'OC\\Preview\\TXT',
7 => 'OC\\Preview\\MarkDown',
8 => 'OC\\Preview\\OpenDocument',
9 => 'OC\\Preview\\Krita',
10 => 'OC\\Preview\\Movie',
),
'token_auth_enforced' => true,
'htaccess.RewriteBase' => '/',
'memcache.local' => '\\OC\\Memcache\\APCu',
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'filelocking.enabled' => 'true',
'redis' =>
array (
'host' => '/run/redis/redis.sock',
'port' => 0,
),
'mail_smtpmode' => 'smtp',
'mail_smtpsecure' => 'ssl',
'mail_sendmailmode' => 'smtp',
'mail_smtpauthtype' => 'LOGIN',
'mail_from_address' => 'xxx',
'mail_domain' => 'xxx',
'mail_smtpauth' => 1,
'mail_smtphost' => 'xxx',
'mail_smtpname' => 'xxx',
'mail_smtppassword' => 'xxx',
'mail_smtpport' => 'xxx',
'maintenance' => false,
'theme' => '',
);
I do not see any deny entries in my SElinux audit.log and setting setenforce 0
does not solve the problem.
In the security log on the windows server I only see successful authentications, logins and logouts from the dummy user used for the SMB share access…
Probably unrelated but added just in case:
I had similar error logs when I was trying to connect a “local external” nfs share, but there I could neither see or write to the share from the Nextcloud server although the “apache” user could if I tried myself (with sudo su apache
)… I do however think the NFS problems are more likely related to me not getting UNIX user mapping to work on the windows server NFS share…
Any help appreciated!