On Jan 16, 2024, at 6:26 AM, Brian J. Murrell <brian@xxxxxxxxxxxxxxx> wrote: > > Let's say I create a new ext4 filesystem for exclusive use by alice and > when I mount it, say, on /mnt/alice I set the permissions so that alice > can work in that directory: > > # mkfs.ext4 /dev/foo > # mount /dev/foo /mnt/alice > # chown alice:alice /mnt/alice > # chmod 775 /mnt/alice > > But now /mnt/alice/lost+found is at the mercy of alice since she has > write permission for /mnt/alice. > > [How] can I protect /mnt/alice/lost+found from removal by alice? You might be able to mark the directory with "chattr +a lost+found" (append only) so that new files can be written there but not deleted even with malice, except by the root user. Not 100% sure that It would be useful to have a patch that allowed that directory to be renamed ".lost+found" so that it is not visible in normal "ls" by users, but still available for e2fsck to store files if needed, since it would be very unlikely to be deleted in the first place if hidden. I'd expect that it would be a few lines patch to e2fsck to check both names, and a new mke2fs option like "-E hidden_lost_found" and allow it to be renamed by "mv" on existing filesystems. Cheers, Andreas
Attachment:
signature.asc
Description: Message signed with OpenPGP