[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <4F9ECC50-EE67-44D6-816D-81F6EB840A69@dilger.ca>
Date: Tue, 16 Jan 2024 19:31:03 -0700
From: Andreas Dilger <adilger@...ger.ca>
To: "Brian J. Murrell" <brian@...erlinx.bc.ca>
Cc: Ext4 Developers List <linux-ext4@...r.kernel.org>
Subject: Re: Protecting lost+found from rmdir by directory owner?
On Jan 16, 2024, at 6:26 AM, Brian J. Murrell <brian@...erlinx.bc.ca> 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
Download attachment "signature.asc" of type "application/pgp-signature" (874 bytes)
Powered by blists - more mailing lists