I'm trying to come up with a method to store image files long term in a manner where they can be accessed but not changed (Write Once Read Many)

  • Files will be ~1MB in size per, I don't expect to have more than 1000 or so over the lifetime. I may choose to burn a batch to CD/DVD for long term offline storage
  • I'd like them in a format where I can read the file at any time but not modify or delete it
  • new files can be added at any time in an automatic manner

I've looked at a few different options and I haven't found anything that works yet. The closest thing I found was using chattr to set the immutable bit on ext4. The downside of that is only root can set the bit, even if I own the file. I'd rather not go down that route if possible.

  • "The downside of that is only root can set the bit, even if I own the file. I'd rather not go down that route if possible." This is actually an upside, if any user could modify the bit, it means that any user could write or delete the file.
    – TZubiri
    Commented Mar 1, 2020 at 0:30

2 Answers 2


Why not simply mount the filesystem as read only?

If writing is scarce, you can remount it as read/write when saving the pictures and then remount it as read only afterwards.

  • Nope, requires root access to remount with different options. If I'm going to have a helper application that runs as root I may as well stick with chattr Commented Sep 12, 2016 at 15:50

If you set these default ACLs on the directory:

setfacl -dm u::rx,g::rx,o::rx the-directory

Then files and directories created in it will be read-only (for everybody).

Note however that it doesn't prevent users from changing the permissions of the files they create afterwards.

Also note that it overrides the umask (it will make the files world-readable even if the umask would otherwise have restricted that read access).

  • I'm leaning this way as I only have one application that's going to drop files in there. I can set acls after adding the file to that location. I might just need to drop my requirements to "avoid accidental deletion" Commented Sep 12, 2016 at 16:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .