Best way to make a folder or file read-only?

I’ve been searching through the forums, existing apps, googling in general, etc. but have failed to find any satisfactory answers or solutions to this question.

What is the best way for the owner of a folder or file to make that folder or file read-only, including for themselves, ensuring that it is protected from modification regardless of access method (web UI, WebDAV, remote client, REST API, some app, etc.) and in the context of sharing permissions, etc. akin to “chmod a-w” such that when applied to a file in a folder that has been shared with some group where the group has edit rights to the folder, the file becomes read-only for all users, both the owner as well all users the file is shared with.

I’ve looked at the core sharing functionality, Workin2Gether, Group Folders, Tags + File Access Controls, WebDAV LOCK/UNLOCK, but feel I must be missing something obvious and straightforward, which has simply eluded my searching.

Is there some existing method to achieve this that I’m missing, or am I going to have to implement a solution myself, or hack the core or an existing app in some manner to do it?

1 Like

have you tried sharing a file or directory with read-only rights?

meaning: you either need to have a special user how once uploads the unchangable files to his account and then share it to you and other “read-only” or you share it from your user to such a directory and share it from there to others, read-only. since you seem to exclude yourself from changing things conicidentially, i would suggest version 1 to you.

it’s a bit umcomfy but i think it would work.

It’s not just about sharing, but also making the folder or file immutable/protected from the owner’s own actions (apart from making it writable again). Also, having separate shared folders, one with read-write and one with read-only would require moving folders and files to the read-only space, and that brings a great many usability and practical issues by changing what is often a deliberate and specially structured organization of folders and files.

The need is simply to be able to make a particular folder (and its subtree) or specific file immutable, without changing anything else.

afaik there’s no app that would help you changing the rights on said folder (without knowing if an r/w folder would allow you to automatically make any file in it read-only - without changing every single file to read-only)…

so again. if you want to have a group being able to put files in directory make a group-account (set up an account and share the password to members of virtual group (aka give it to guy 1, guy 2, guy 3 etc))…
this groupaccount (GA) can share files to every member of your NC-instance marking it read-only. which means: even the guy who made a certain file won’t be able to access it (other than read-only) from its own account unless he’s logging in to GA to change it.
that doesn’t sound like being overly complicated. if you don’t wanna give out the password of GA you need to elect one person being in charge of GA. everyone should send (sharfe?) their files to the elected person how is obliged to put it into GA-account. so it would always be clear who is responsible.

Necro-posting a little (ahem) but I’m looking for just that, mostly because I’m uploading ~4TB of photos/videos that don’t need to be changed or serted after I’m done with them, I just want them in NC as an easily accessible archive and such.

I haven’t yet found an “official” way, everything is just workarounds. But I’ve accidentaly noticed something that could help. One of the files I’ve uploaded through SSH (from external USB drive to server drive) couldn’t be deleted, moved, renamed or edited. But it could be viewed/accessed. Eventually I’ve found that it had permission set differently in the database itself:

SELECT * FROM oc_filecache WHERE permissions = 19;

Changing that “19” to “27” that other files have made it available for other file operations.

Now it seems I’d need to find an app that makes that available through web interface. Simple “right-click → make read only” on a folder, and having app going through database for all files.

Unfortunately, coding for NC seems a bit too complicated for me to do it.

Unless I find a better way, I’ll probably just go to database and issue a command like:

UPDATE oc_filecache SET permissions = 19 WHERE path LIKE '%MyPhotos%' ;

If anyone has a better way, please reply, I’d like to know.

P.S. To explain, that part that patrick also mentioned, wanting to protect “against myself” as well, I want to make sure these “archives” don’t disappear or get mangled in the future, which could happen by accident or by some kind of malware or whatever, having files as read-only for ALL accounts would make it improbable for such “accident” to happen, unless it happens directly via OS level access (SSH or physical).

3 Likes

This would be a neat feature, similar like in Notepad++ where you can tick on read-only to protect from accidental modifications.
Especially laptop pad mouse, not 10 but 1000 times happened that all of the sudden files are being dragged and dropped somewhere.

Doesn’t seem to make a docx document read-only. Nice try though.