Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve file access permissions #18

Open
Fell opened this issue Apr 29, 2024 · 1 comment
Open

Preserve file access permissions #18

Fell opened this issue Apr 29, 2024 · 1 comment

Comments

@Fell
Copy link

Fell commented Apr 29, 2024

It would be nice to add an option that ensures that anyone who had access to the file before hardlinking also has access afterwards.

Example:
Before hardlinking:

-rw-r--r-- 1 alice alice 120000 Apr 29 20:31 image.jpg
-rw-r--r-- 1 bob   bob   120000 Apr 23 16:41 image2.jpg

After hardlinking:

-rw-r--r-- 2 alice alice 120000 Apr 29 20:31 image.jpg
-rw-r--r-- 2 alice alice 120000 Apr 29 20:31 image2.jpg

User bob has essentially lost write access to the file.

Since there are multiple ways of solving this problem, I want to discuss possible solutions, such as:

  • Specifying fixed ownership and permissions for every hardlinked file
  • Automatically relaxing file permissions, like performing chown and chmod g+rw if alice and bobshare a common group.
  • Preserving access through ACLs (my favourite)

I would be willing on working on the implementation if neccessary.

@kornelski
Copy link
Owner

kornelski commented Apr 30, 2024

Yes, PRs for this are welcome.

I think the principle should be that access is never relaxed beyond original permissions (no new users/groups can access the file). It may be ok to skip hardlinking files when the permissions can't be changed to match (limiting dedupe to a single user, or requiring running under sudo).

I'm not sure what are the consequences of using ACLs. I'm worried that changing access from old-primitive-unix style could confuse some programs, or users would have harder time undestanding and changing permissions afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants