LWN: Comments on "Secure deletion and trash bin support" https://lwn.net/Articles/212794/ This is a special feed containing comments posted to the individual LWN article titled "Secure deletion and trash bin support". en-us Fri, 19 Sep 2025 22:00:45 +0000 Fri, 19 Sep 2025 22:00:45 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Secure deletion and trash bin support https://lwn.net/Articles/214101/ https://lwn.net/Articles/214101/ renox <font class="QuotedText">&gt;&gt;The nicest file manager available will not be able do do anything about an "rm" command typed into a shell,[...]</font><br> <font class="QuotedText">&gt;Ummm, that's a feature, not a bug.</font><br> <p> Depends, some of us believe that command-line interface and GUIs should behave *consistently*, as much as possible.<br> <p> <p> Thu, 14 Dec 2006 10:05:29 +0000 Secure deletion and trash bin support https://lwn.net/Articles/213449/ https://lwn.net/Articles/213449/ martin@zeroscale.com In my opinion there is no need for a Trash system within the kernel. Look at Mac OS X, their Finder <br> application handles the Trash, not the kernel. If you do "rm", your file is deleted. People who work <br> on that level don't want a Trash. <br> <p> The idea of secure deletion feature I like. But this should be handled by the filesystems or the VFS, <br> not send back to userspace by putting it in the trash. If userspace has to handle it anyway, it does <br> not need the trash to blank a file before deletion.<br> <p> But it is again Mac OS X which can teach us a lesson: Look at their idea of "Timemaschine". <br> Something like this is way more useful than a dot-root-trash sitting somewhere. <br> Sat, 09 Dec 2006 07:59:17 +0000 trash bin https://lwn.net/Articles/213374/ https://lwn.net/Articles/213374/ giraffedata <p>Presence of a .trash directory (a filesystem option) and a mount option are two different things, both valuable. In reality, I think users wouldn't be satisfied with undeletion without an entire storage management policy capability. The decision whether to delete a file as soon as the last normal reference disappears or keep it around in the trash needs to be based on what directory, filesystem, and mount the file was in as well as its name, and various attributes such as owner, size, and modification time. <p> But to make something mildly useful to some people, just a filesystem option (probably simply the existence of the .trash directory in its root) would be reasonable. <p> I don't even think the per-file attribute would be useful in a system that simple -- I don't know how the designers of the system in question envision that getting set. Fri, 08 Dec 2006 19:23:54 +0000 Does this not handle unsafe overwrites? https://lwn.net/Articles/213372/ https://lwn.net/Articles/213372/ giraffedata Right. What we want is secure de-allocation, not secure delete. That looks more like attaching deallocated blocks to a .trash file than linking unreferenced files to a .trash directory. Fri, 08 Dec 2006 19:03:54 +0000 Secure deletion and trash bin support https://lwn.net/Articles/213330/ https://lwn.net/Articles/213330/ niallm It's the difference between un-deleteable and undelete-able.<br> Fri, 08 Dec 2006 15:48:18 +0000 Secure deletion and trash bin support https://lwn.net/Articles/213328/ https://lwn.net/Articles/213328/ rwmj <p><i>The nicest file manager available will not be able do do anything about an "rm" command typed into a shell,[...]</i></p> <p>Ummm, that's a feature, not a bug.</p> <p>Rich.</p> Fri, 08 Dec 2006 14:27:50 +0000 Secure deletion and trash bin support https://lwn.net/Articles/213281/ https://lwn.net/Articles/213281/ liljencrantz I've read through all your complaints about trash, and as near as I can tell, they fall in two categories:<br> <p> * Problems that are solved by the /UID/ indirection<br> * Problems that are solved by not changing the access permissions or ownership of the file when moving it to trash.<br> <p> If I have missed any cases, please point them out to me.<br> <p> Fri, 08 Dec 2006 01:37:57 +0000 Secure deletion and trash bin support https://lwn.net/Articles/213278/ https://lwn.net/Articles/213278/ nix Actually, the .uid stuff prevents some of these attacks.<br> <p> Just some. Not all :/<br> Fri, 08 Dec 2006 01:16:31 +0000 Does this not handle unsafe overwrites? https://lwn.net/Articles/213277/ https://lwn.net/Articles/213277/ nix Yeah, I have a feeling this is yet *another* problem with this proposal.<br> <p> I guess I should go and read the actual patch and moan on l-k if these <br> problems really do exist. (Still, I'm the last-ditch Viro Defence Force <br> would spot them if I didn't complain. I'm almost tempted not to moan<br> because Al's demolition is bound to be so much more amusing than any I <br> could come up with... ;) )<br> <p> Fri, 08 Dec 2006 01:15:32 +0000 Secure deletion and trash bin support https://lwn.net/Articles/213274/ https://lwn.net/Articles/213274/ nix Great. I guess I'd better point out some of these DoS scenarios...<br> <p> Given users a and b, in group C, where (all paths filesystem-relative):<br> <p> / is writable by user a, with the sticky bit on, and readable and <br> executable by everyone (of course).<br> /bar is writable by group C.<br> /baz is writable by user b only, and not readable by anyone else.<br> /foo is writable by user x, who is known to be a bit of a mischievous sod, <br> and not by user b.<br> <p> User b deletes a file in /bar. Now presumably /.trash inherits its <br> permissions from /, right? Well, that file's just gone into /.trash, which <br> *b cannot delete files from*. So now user b can fill up the disk just by <br> creating and deleting files, but has to appeal to a to fix things.<br> <p> Worse, files b delets in /baz can only be deleted from /.trash by user a, <br> even though user a *cannot delete them from /baz in the first place*.<br> <p> But it gets nastier. What if user a deletes an important file and then <br> user x spots this and immediately afterwards deletes a file with the same <br> name from /foo? Does that file overwrite the important file in /.trash? Do <br> the files in /.trash get the directory name encoded in their filename <br> somehow, to evade this? (If so, that means you can break the system in <br> another way: the encoding for filenames must, if not ambiguous, sometimes <br> be longer than the filenames themselves. Thus it's possible to produce a <br> file in a deeply-nested directory which has a name which is too long, when <br> encoded, to be written to /.trash.)<br> <p> Another scenario: user b deletes an important file out of /baz: it was <br> group-readable, but what the hell, it's in a directory they can't read <br> anyway. But now it's been deleted, that is no longer true: now user x can <br> read it. Worse, user x can hardlink it into his own directory, and b can't <br> do anything about it: can't even delete it again. However, it is possible <br> depending on the semantics of repeated deletion that he may be able to <br> *overwrite* it by deleting another file with the same name (in which case <br> deleting symlinks seems risky, as that's opened up an rm variant of the <br> classic symlink attack: delete a symlink to /etc/passwd, wait for root to <br> delete a file with the same name, oops: worse, an attacker with write <br> privs in /.trash can delete anyone's file by hardlinking it into /.trash <br> under a suitable name and waiting for someone to delete a suitable file: <br> no, overwriting is not safe, you must unlink()).<br> <p> And then what happens if you flip on the immutable bit for files <br> in /.trash?<br> <p> So now we have rm(1) not consistently trashing files, possibly leading to <br> unreadable-by-others files becoming readable by them and unremovable by <br> you, or alternatively leading to arbitrary files that happen to have <br> symlinks pointing to them or happen to have been hardlinked into or out <br> of /.trash being overwritten.<br> <p> This proposal needs a *lot* of thought. Either /.trash is fantastically <br> magical and violates most Unix rules for file access (hardlinks out of and <br> into banned, *symlinks* out of and into banned, always 1777 except that <br> files belonging to other users don't appear, um, how will that work <br> exactly?) or you've opened a vast can of worms.<br> <p> (A plan9-style per-user /.trash bind-mount might work better, but the <br> userspace infrastructure for that is not really there yet.)<br> Fri, 08 Dec 2006 01:11:18 +0000 Secure deletion and trash bin support https://lwn.net/Articles/213273/ https://lwn.net/Articles/213273/ nix This is, of course, not to be confused with the immutable attribute, which <br> (among other effects) makes a file un-deletable.<br> <p> (gah.)<br> <p> The trash directory thing has all sorts of horrible potential problems, <br> though, particularly when group- or world-writable directories are <br> concerned. (World-writable isn't common outside of /tmp, but <br> group-writable is common.)<br> <p> I can see half a dozen ways to DoS the system with this alone, especially <br> if users can set attributes on the trash directory such that users can ask <br> to move files in there but then don't have privileges to delete them from <br> there...<br> Fri, 08 Dec 2006 00:54:03 +0000 Does this not handle unsafe overwrites? https://lwn.net/Articles/213251/ https://lwn.net/Articles/213251/ droundy It sounds like this patch doesn't handle the "secure" files in the case where their contents may be modified. In that case, the old contents could end up being left around on disk somewhere (e.g. if I run "echo &gt; secure_file.txt"). Am I missing something, or is the patch missing something?<br> <p> David<br> Thu, 07 Dec 2006 23:22:03 +0000 Secure deletion and trash bin support https://lwn.net/Articles/213228/ https://lwn.net/Articles/213228/ jzbiciak I'm saying that I might simply not want a .trash directory in a particular filesystem *ever*. For instance if I have an FS that I use for large temporary files, I don't think it should get a .trash, ever.<br> Thu, 07 Dec 2006 21:17:47 +0000 Secure deletion and trash bin support https://lwn.net/Articles/213227/ https://lwn.net/Articles/213227/ oak <font class="QuotedText">&gt; I suppose it'll need to be a mount option in addition to a kernel </font><br> <font class="QuotedText">&gt; feature. </font><br> <br> Yes, there would need to be .trash dir for each file system... <br> Thu, 07 Dec 2006 21:03:19 +0000 Secure deletion and trash bin support https://lwn.net/Articles/213216/ https://lwn.net/Articles/213216/ jzbiciak I suppose it'll need to be a mount option in addition to a kernel feature. Even then I'm not sure it's perfect. For instance, what if /tmp isn't in its own filesystem?<br> <p> Granted, it's a per-file attribute, so you have to remember to set it before you make a mistake anyway. Perhaps the attribute should be inherited from the current directory, one could set things up hierarchically? "I want undelete available in this tree, but not that one."<br> Thu, 07 Dec 2006 20:32:59 +0000 Secure deletion and trash bin support https://lwn.net/Articles/213193/ https://lwn.net/Articles/213193/ bronson I'm not a fan of undeleting in, say, /var. But in /home that would ROCK. They'd just have to give some thought to how to handle metrics (like, if I delete a file and my available disk space doesn't change, I'd be mighty confused).<br> <p> I wish Joukov luck -- I really look forward to using this.<br> Thu, 07 Dec 2006 18:31:32 +0000 Secure deletion with journaling? https://lwn.net/Articles/213167/ https://lwn.net/Articles/213167/ rvfh The secure deletion resides in the FS part for sure. Only the undelete part can be in the VFS (just a mv after all). Thu, 07 Dec 2006 16:52:50 +0000 Secure deletion with journaling? https://lwn.net/Articles/213153/ https://lwn.net/Articles/213153/ zlynx Overwrite the file with O_DIRECT set? Create a new filesystem flag so that even the most cache-happy journaled FS does the right thing?<br> Thu, 07 Dec 2006 15:20:21 +0000 Secure deletion with journaling? https://lwn.net/Articles/213135/ https://lwn.net/Articles/213135/ abatters According to the man page for 'shred', overwriting a file stored on a journaled filesystem (via normal write() system calls) does not necessarily overwrite the actual data on disk. I do not see how moving a deleted file to a special directory makes it possible to perform a subsequent secure delete if the VFS doesn't special-case it in other ways. This is especially true if the data had been written to blocks in the filesystem that are no longer associated with the file.<br> <p> OTOH, the man page for chattr does mention a 'data journaling' attribute; maybe you are supposed to turn off data journaling at the same time as setting secure delete (preferably before writing any actual sensitive data to the file). Does anyone know if this flag is honored?<br> <p> Thu, 07 Dec 2006 15:04:46 +0000 Secure deletion and trash bin support https://lwn.net/Articles/213133/ https://lwn.net/Articles/213133/ Robin.Hill Yes, the undeletable attribute means that the file can be undeleted. This is separate from the secure deletion attribute which means the file should be totally erased (and therefore not undeletable).<br> <p> The initial step in this proposal is the same for both attributes - the file is moved to a trash directory. The user process will then check these files and, for those with the secure deletion flag set, erase them. Those with the undeletable attribute set will just be left in the trash directory (presumably trying to set both attributes will produce an error somewhere!).<br> Thu, 07 Dec 2006 14:24:06 +0000 Secure deletion and trash bin support https://lwn.net/Articles/213084/ https://lwn.net/Articles/213084/ nix Hm, actually, I think you may have been saying the same thing and I misread it. It really is *not* a very good name for an attribute...<br> Thu, 07 Dec 2006 10:36:59 +0000 Secure deletion and trash bin support https://lwn.net/Articles/213083/ https://lwn.net/Articles/213083/ nix My understanding was that the `undeletable' attribute led ext[23] to try to make the file easier to undelete: the opposite effect.<br> <p> It's a rather bad name for an attribute, really :/<br> Thu, 07 Dec 2006 10:36:05 +0000