All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Wallace <tony@tony.gen.nz>
To: Richard Weinberger <richard.weinberger@gmail.com>
Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: Suggested new user link command
Date: Wed, 2 May 2018 00:17:13 +1200	[thread overview]
Message-ID: <388f79ad-4ed0-ec39-f649-5c120ee9dc2f@tony.gen.nz> (raw)
In-Reply-To: <CAFLxGvxpe78WhrEKcKRt5XRBMtT-mZUe9Bm=sQsn8-f1TnX0eQ@mail.gmail.com>

Two issues here:
1) Use case (which I have)
2) Permissions

1) Use case

I am trying to build a backup system.  To avoid duplication of files
over multiple backups I take an Md5 check sum of file contents.  Files
with the same sum are hardlinked together.   Files are linked in to a
standard directory structure a new link for each backup that the file is
part of.  When all backups pointing to a file are deleted the reference
count drops to zero and the file is deleted.  We can keep a database of
checksums and there related inode numbers for linking purposes.  So why
not have some reference copy to link against it would take no extra
space.  Well it doesn't, but it keeps at least one copy of the file on
disk forever and the reference count never drops to zero.  Using one of
the backup copies to link to (as stored as the reference copy in the
database) will not work as it could be deleted at any time.

I have seen on stack overflow others wanting to do this also.

2) Permissions

To maintain security there are two requirements: 
2.1) The effective user must have rights to the inode, that is they must
either own it or be root
2.2) The effective user must have rights file creation rights to the
directory where it is being linked

If you say no, that is fine, but I do think this idea has merit and can
be done without compromising the system.

I am off to bed, it is the middle of the night here in New Zealand.



Tony


On 01/05/18 23:04, Richard Weinberger wrote:
> On Tue, May 1, 2018 at 12:58 PM, Tony Wallace <tony@tony.gen.nz> wrote:
>> Good point.  But there are gid and uid fields in inode disc record.
>>
>> https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#Inode_Table
>>
>> I assume these can be use to ensure that the directory in which it is to
>> be placed has permissions to accept the inode.  If that is not the case
>> then it would have to be a root only syscall.
> Before we dig into details, please come up with a very good use case. :-)
> But I'm with Bernd, I don't think it is worth the permissions hassle.
>

  reply	other threads:[~2018-05-01 12:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-01  8:03 Suggested new user link command Tony Wallace
2018-05-01  9:03 ` Bernd Petrovitsch
2018-05-01 10:58   ` Tony Wallace
2018-05-01 11:04     ` Richard Weinberger
2018-05-01 12:17       ` Tony Wallace [this message]
2018-05-01 13:35         ` Bernd Petrovitsch
2018-05-01 18:41           ` Tony Wallace
2018-05-05  5:10             ` Eric W. Biederman

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=388f79ad-4ed0-ec39-f649-5c120ee9dc2f@tony.gen.nz \
    --to=tony@tony.gen.nz \
    --cc=bernd@petrovitsch.priv.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard.weinberger@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.