SOLVED: Nextcloud can read Samba files but cannot save changes — Linux permissions explained for beginners
Environment: Nextcloud 35 in Docker, Raspberry Pi OS, Samba, and an external EXT4 hard drive.
The problem
I wanted one household file collection accessible from Windows and Chromebook computers through Samba (SMB), and through Nextcloud’s web interface.
Nextcloud could open the files, but when I edited one, it could not save the changes.
The important lesson was that permission to read a file does not automatically include permission to modify it.
What caused the failure?
Our original test file was created from a Linux terminal using sudo. It had these permissions:
Owner=root
Group=household
Permissions=644
With permissions 644, only the owner (root) can write to the file. Nextcloud could read it, but its web-server process could not save changes.
The Nextcloud log confirmed a Permission denied error when attempting to write the file.
Our working solution
We use a shared Linux group named household for files accessed through Samba and Nextcloud.
Our arrangement includes:
-
Samba users belonging to the
householdgroup. -
Nextcloud’s web-server user (
www-data) having access to that group inside its Docker container. -
Shared directories with group inheritance and write access.
-
Shared files with group read/write permissions.
Our working Samba share configuration includes:
[Family]
path = /mnt/homelab/household/Family
valid users = rowlette lora
force group = household
create mask = 0660
directory mask = 02770
read only = no
Important: Samba’s create mask limits permission bits; it does not guarantee that every new file will receive group-write permission. Always verify actual file permissions.
Understanding the permissions
Directories: 2770
-
2— New files and folders inherit the directory’s group. -
7— Owner has full access. -
7— Group has full access. -
0— Others have no access.
Files: 660
-
6— Owner can read and write. -
6— Group can read and write. -
0— Others have no access.
To inspect permissions without changing anything:
stat -c 'Owner=%U | Group=%G | Permissions=%a' "/path/to/file.txt"
Replace the example path with your actual file.
For our original root-owned test file, we corrected only that file’s permissions:
sudo chmod 664 "/path/to/test-file.txt"
This allowed group writing. It did not change ownership.
Do not recursively change permissions throughout Nextcloud or your household files without understanding the consequences.
Docker consideration
Our Nextcloud container uses a customized image so its Apache web-server process belongs to the correct shared group.
The shared household directory is also mounted inside the container.
If you use Docker, check the group membership and filesystem access inside the container, not just on the Linux host.
How we verified the solution
We tested the entire process:
-
Created a folder through Samba using a Chromebook.
-
Verified the folder belonged to
householdand had permissions2770. -
Created a text file through the Chromebook’s Samba connection.
-
Verified the file belonged to
householdand had permissions660. -
Opened the file in Nextcloud.
-
Added a second line using Nextcloud Text.
-
Read the actual file directly from the Linux hard drive.
The final file contained:
Samba permissions test
Nextcloud write test successful
Both lines were present on disk.
Result: Successful read and write access through Samba and Nextcloud, verified against the same physical file.
Advice for Linux beginners
If Nextcloud opens a file but cannot save it:
-
Check the file’s owner and group.
-
Check whether the group has write permission.
-
Confirm that Nextcloud’s web-server process has the required group access.
-
If using Docker, verify access inside the container.
-
Test with a disposable file before changing important documents.
Avoid creating ordinary shared files using sudo unless you understand the ownership and permissions that will result.
This was a Linux filesystem permissions issue in our Samba/Nextcloud integration, not a confirmed Nextcloud software bug.
Our solution is specific to our environment, but the diagnostic approach may help others with similar symptoms.
Acknowledgment: This solution was developed collaboratively by a HomeLab user learning Linux and ChatGPT (OpenAI). ChatGPT assisted with technical diagnosis and instructions; the HomeLab user performed the configuration, testing, and independent verification of the results.