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

update-users-groups.pl: create intermediate home directories as 0755 #50857

Closed
wants to merge 1 commit into from

Conversation

cyounkins
Copy link
Contributor

Motivation for this change

Creates directories between / and the home directory as 0755 instead of 0700.

Fixes #10888 where users with home dirs outside /home receive "No directory, logging in with HOME=/" upon login and cannot access their home directory.

In the default installation, /home/ is 0755 so I used that for other locations.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@Mic92
Copy link
Member

Mic92 commented Nov 21, 2018

I am not sure if really we should fix this in NixOS or leave it up to the user to make sure the access is right. We don't really know, what the intention of the users is in that case. The upper directory could be also owned by the user itself.

A simple fix could be a user could apply is:

systemd.tmpfiles.rules = [
  "d /some/home 0755 root root"
];

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though this might not be the best solution, it's a solution, and I think this is better to merge this than continue leaving it broken.

Unless somebody brings up a good reason this shouldn't be done I'll merge this soon

make_path($u->{home}, { mode => 0700 }) if ! -e $u->{home};
if (! -e $u->{home}) {
my @dirs = splitdir($u->{home});
make_path(catdir(@dirs[0..$#dirs - 1]), { mode => 0755 });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be simpler to only call make_path on the last component? That functions seems to create all intermediate directories already

@stale
Copy link

stale bot commented Jun 1, 2020

Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the
    related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse. 3. Ask on the #nixos channel on
    irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 1, 2020
@Mic92
Copy link
Member

Mic92 commented Jun 5, 2020

Even though this might not be the best solution, it's a solution, and I think this is better to merge this than continue leaving it broken.

Unless somebody brings up a good reason this shouldn't be done I'll merge this soon

See my concern above: #50857 (comment)

It's easier for someone, who uses weird home directories to also take care of fixing the ownership with tmpfiles rules rather than working around our assumptions that we do when creating the user's home directory.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 5, 2020
@Mic92 Mic92 closed this Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect Home Directory Permissions
4 participants