mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pablo Alcaraz <pabloa@laotraesquina.com.ar>
To: James D Strandboge <jstrand1@rochester.rr.com>
Cc: LINUX-KERNEL <linux-kernel@vger.kernel.org>
Subject: Re: ext3 and undeletion
Date: Sat, 02 Mar 2002 14:36:52 -0300	[thread overview]
Message-ID: <3C810DB4.7020606@laotraesquina.com.ar> (raw)
In-Reply-To: <4188788C3E1BD411AA60009027E92DFD063077D8@loisexc2.loislaw.com> <20020227210026.GA18660@rochester.rr.com>

James D Strandboge wrote:

>On Tue, Feb 26, 2002 at 11:48:49AM -0600 or thereabouts, Rose, Billy wrote:
>
>It seems to me the undelete could be in the kernel, and could be
>beneficial.
>
>Rather than modifying all the different filesystems, or libc, we could
>modify the VFS unlink function in the kernel.  It would therefore work
>with all filesystems working under VFS, and all programs regardless of
>whether it is linked against the latest libc or using LD_PRELOAD.
>
>There are obviously some issues that would have to be resolved with the
>algorithm, but as far as versioning I think that is the role of backups.
>This should be more along the lines of 'whoops I deleted /etc/fstab.
>Let me go get it out of /.undelete'.  Simply put, if the file is already
>in there, just overwrite it.  Though, it wouldn't be too hard to tack a
>.1 on the end of the old file I suppose.
>
>Also, if the files are just moved to the .undelete directory (and by
>moved, I mean a hard link to .undelete, followed by a remove of the
>original), disk usage as reported by df and du would still show it
>as there.  I don't think that is a very big deal.  I simple solution
>would just be to have a cron job empty out older files.  It should be the
>sysadmin's job on how to manage the .undelete directory, not the kernel's
>(IMO).  Of course, a configurable daemon to monitor the directory could
>be implemented, but this especially seems like a userspace problem.
>
>Undeleting is the harder of these.  User's should be able to undelete a
>file IMO.  Either an suid binary has to be created to list the contents
>of the .undelete directory based on the user running it, or they can go
>into the directory and get what they need.  Rather than having a world
>write /tmp like directory, it could be chmod 1755 with root ownership.
>That way users could browse the directory and cp out what they wanted,
>but they can't write to it and overwrite files and do symlink attacks,
>etc.  This is a security issue in terms of privacy though, depending on
>the user's umask.  The former (an suid binary) is probably better, but
>the latter is the easier to implement.
>
>Please comment.
>
>James Strandboge
>




My 2ctvs.

An example:
We have a file server with these fs mounted in /mnt

/
+-mnt
|   +-fs1
|   |  +-dir1
|   |  |  +--rw-r--r--    1 root     root          121 dic 13 19:47 
file1.txt
|   |  |  +--rw-r--r--    1 paul     sales      232121 dic 13 19:47 
file2.txt
|   |  +-dir2
|   |  |  +--rw-r--r--    1 root     root        72534 dic 14 20:27 
file1.txt
|   |  |  +--rw-r--r--    1 mary     sales        9493 dic 14 20:27 
file2.txt
|   +-fs2
|   |  +-dir1
|   |  |  +--rw-r--r--    1 root     root         2312 dic 13 19:55 
other1.txt
|   |  |  +--rw-r--r--    1 root     root          232 dic 13 19:55 
other2.txt
|   |  +-dir2
|   |     +--rw-r--r--    1 root     root         2534 dic 14 20:34 
file1.txt
|   |     +--rw-r--r--    1 root     root          493 dic 14 20:54 
file2.txt
|
.



Then, UserA delete /mnt/fs1/dir1/file2.txt and UserB delete 
/mnt/fs1/dir2/file2.txt and create a new one. The state of the file 
server will be:

+-mnt
|   +-fs1
|   |  +-dir1
|   |  |  +--rw-r--r--    1 root     root          121 dic 13 19:47 
file1.txt
|   |  +-dir2
|   |  |  +--rw-r--r--    1 root     root        72534 dic 14 20:27 
file1.txt
|   |  |  +--rw-r--r--    1 UserB    sales        9493 Mar 02 12:22 
file2.txt
|   |  +-.undelete
|   |     +--rw-r--r--    1 paul     sales      232121 dic 13 19:47 
+2001-12-13 19:47:23+dir1+file2.txt
|   |     +--rw-r--r--    1 mary     sales        9493 dic 14 20:27 
+2001-12-14 20:27:44+dir2+file2.txt
|   +-fs2
|   |  +-dir1
|   |  |  +--rw-r--r--    1 root     root         2312 dic 13 19:55 
other1.txt
|   |  |  +--rw-r--r--    1 root     root          232 dic 13 19:55 
other2.txt
|   |  +-dir2
|   |     +--rw-r--r--    1 root     root         2534 dic 14 20:34 
file1.txt
|   |     +--rw-r--r--    1 root     root          493 dic 14 20:54 
file2.txt
|
.


I mean:

When a user delete a file, the old version would be moved to .undelete 
directory and renamed:

yyyy-MM-dd hh:mm:ss+directory+from+became+filename.ext

and there would be a '.undelete' directory inside each mounted fs (with 
undelete option in /etc/fstab?).

In this way we can undelete erased files AND complete directory erases.
The date/time attr of the files in 'undelete' directory could be set the 
delete time.

The rwx attr do not change



Another filename version could be:

yyyy-MM-dd 
hh:mm:ss+owner_user+owner_group+rwxrwxrwx+directory+from+became+filename.ext

The date/time attr of the files in 'undelete' directory would have the 
delete time AND the uid/gid would have the uid/gid of the user that 
delete the files, so he/she will have rights to undelete it.

The rwx attr changes to 440 I think...



If the fs does not support long names, then we could to move and rename 
it as file1.txt.1, file1.txt2, etc...


A undelete utility that complete the picture would be usefull.


Sorry my English. ;-)


Pablo



  parent reply	other threads:[~2002-03-02 17:38 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-26 17:48 Rose, Billy
2002-02-26 17:53 ` Martin Dalecki
2002-02-26 18:03   ` Mike Fedyk
2002-02-26 17:56 ` Rik van Riel
2002-02-26 19:41   ` Andreas Dilger
2002-02-26 18:00 ` H. Peter Anvin
2002-02-26 18:15   ` Andreas Dilger
2002-02-26 18:23     ` Jakob Østergaard
2002-02-26 18:19   ` David Lang
2002-02-26 18:29 ` Andreas Ferber
2002-02-27 21:00 ` James D Strandboge
2002-02-27 21:40   ` Alan Cox
2002-02-27 22:16     ` James D Strandboge
2002-02-27 22:33       ` Alan Cox
2002-02-27 23:03         ` James D Strandboge
2002-02-28  0:29         ` James D Strandboge
2002-03-04  2:17         ` Mike Fedyk
2002-03-04 15:12           ` Alan Cox
2002-03-04 15:33             ` Mike Fedyk
2002-03-04 19:17             ` James D Strandboge
2002-03-04 20:08               ` Jesse Pollard
2002-03-02 17:36   ` Pablo Alcaraz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-03-05 23:04 Rose, Billy
2002-03-06 20:03 ` Mark Mielke
2002-03-07 21:30 ` Patrick Lynch
2002-02-28 10:37 Randal, Phil
2002-02-26 18:39 Dana Lacoste
2002-02-26 18:47 ` Daniel Gryniewicz
2002-02-26 18:51 ` David Lang
     [not found] <fa.n4lfl6v.h4chor@ifi.uio.no>
2002-02-25 17:06 ` Dan Maas
2002-02-25 17:20   ` Mike Fedyk
2002-02-25 23:33     ` Tom Rauschenbach
2002-02-26  0:27       ` Bernd Eckenfels
2002-02-26  5:53       ` H. Peter Anvin
2002-02-26 16:05         ` Mike Fedyk
2002-02-26 16:31           ` H. Peter Anvin
2002-02-26 16:40             ` Mike Fedyk
2002-02-26 16:55               ` H. Peter Anvin
2002-02-26 17:12                 ` Mike Fedyk
2002-02-26 16:36           ` Martin Dalecki
2002-02-26 16:43             ` Mike Fedyk
2002-02-26 16:54               ` Martin Dalecki
2002-02-26 17:05                 ` Mike Fedyk
2002-02-26 17:07                   ` Martin Dalecki
2002-02-26 17:16                     ` Mike Fedyk
2002-02-26 17:22                       ` Rik van Riel
2002-02-26 17:38                         ` Mike Fedyk
2002-02-26 18:14                           ` Andreas Ferber
2002-02-26 18:55                             ` Andreas Dilger
2002-02-26 22:04                           ` Mike Fedyk
2002-02-26 18:34                       ` Richard B. Johnson
2002-02-26 18:34                         ` H. Peter Anvin
2002-02-26 18:47                           ` Richard B. Johnson
2002-02-26 18:52                         ` Andreas Dilger
2002-02-28 15:05                         ` Andreas Ferber
2002-02-28 22:37                           ` Andreas Dilger
2002-03-01  4:44                           ` Mike Fedyk
2002-03-04 16:26                           ` Pavel Machek
2002-03-05 21:29                             ` Andreas Ferber
2002-03-06 11:30                               ` Pavel Machek
2002-03-05 22:07                             ` Richard B. Johnson
2002-02-28 22:55                         ` James D Strandboge
2002-02-26 17:22                     ` Mike Fedyk
2002-03-01  0:19                       ` Rick Lindsley
2002-03-01  1:02                         ` Andreas Dilger
2002-02-26 17:54                   ` Andreas Dilger
2002-02-26 18:24                 ` Alan Cox
2002-03-04 15:40     ` Pavel Machek
2002-02-25 18:08   ` Richard B. Johnson
2002-02-25 18:40     ` Mike Fedyk
2002-02-25 19:49       ` Andreas Dilger
2002-02-25 16:46 Rose, Billy
2002-02-25  3:27 Steven Walter
2002-02-25  5:08 ` Andreas Dilger
2002-02-25 10:16 ` Fabrice Bellet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3C810DB4.7020606@laotraesquina.com.ar \
    --to=pabloa@laotraesquina.com.ar \
    --cc=jstrand1@rochester.rr.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®