File upload by user does not have group write permission while upload/create

When a nextcloud user is uploading files to any directory. It does not have group write permission.
Example: I uploaded a file it has (-rw-r–r–) permission, how can i make it (-rw-rw-r–) ?
I mean Read+ Write permission on group.

Can you explain why you need it?

I think it is normal that webserver directorys/files are set to 755 or 644 and not 775 or 664.
You can search “webserver umask” for more details. I think it is not a Nextcloud “problem”.

I think you do not need it.
Normally only Webserver/Nextcloud (owner) needs write access.
Do you want to write files in Nextcloud with another user (same group)?
Then you must also use files:scan with occ that Nextcloud knows it.

Please explain your idea.
I think there are better solutions for you.
A better possibility is e.g. WebDAV so that occ files:scan is also omitted.

1 Like

Directly accessing the data folder should be avoided when possible. If you change the permissions, most likely you’ll break it.

1 Like

The problem is I am using a shared storage for uploading file to nextcloud console .
When I try to open uploaded file from another server using the shared storage mounted, it does not have write permission on it. Because by default nextcloud gives only 644 not 755.
@devnull @KarlF12

I think 644 (files) or 755 (directorys) is ok if only one and the same user (e.g. webserver user) uses the storage.

Maybe the storage is just mounted wrong (e.g. /etc/fstab). Post details about the mountpoint, a folder (ls -l) and a file it contains (ls -l). Feel free to rename everything for privacy reasons.

It sounds like you have a fundamental problem with the way you’re trying to use Nextcloud. You should either:

  • Mount the share as external storage in Nextcloud
  • Mount the Nextcloud folder as WebDAV on the other system

ok, How would i change default permission of an external storage of nextcloud ?

The external storage has no permissions that Nextcloud controls other than what users have access to it. It depends on the credentials (if applicable) used to mount it, and what the remote system allows.

Maybe it would be easier if you just explain what you’re trying to do.

I have 3 server, S1, S2 & S3.

S1 is where nextcloud is setup and configured.
S2 is a another server where we access file through another application.
S3 has storage server called GLUSTERFS.

Both server S1 & S2 has GLUSTERFS storage mounted using FSTAB.

When I upload any file using S1 nextcloud UI. It has permission 644 by default, group owner does not have write permission. That’s why S2 can not access the files.

I want S1 nextcloud to set 775 permission when new file uploading through nextcloud UI.

you got the point - you must not temper with Nextclouds files. You should always access files stored in Nextcloud through official interface e.g. WebDAV so the application can keep track of changes and offer functions like trashbin and versions. If you temper with Nextcloud’s storage you are in trouble and have to perform repair steps e.g. occ files:scan - don’t do this!

Thank you :slight_smile:

There are a lot of people saying not to do this. There are definately some security concerns. However, nextcloud provides this as a configuration option as of version 25.
Add to config.php 'localstorage.umask' => 002,
While umask will still return 0022, new folders will be given group write permissions.

1 Like

2 posts were split to a new topic: I plan to brake my system… why do you say I shouldn’t?