Skip to content

Give /tmp/nix-build* in ownership to the nix-build caller #100

Closed as not planned

Description

@viric

When a user requests building through nix-daemon with -K, and the build fails, the resulting /tmp/nix-build-* directory is given in ownership to root.

It'd be nice if it could be given to the user that requested the build, instead.

Activity

  1. Ekleog commented on Jan 18, 2019

    @Ekleog
    Member

    This is a much needed feature when using nix without root rights: it'd allow removing the directory after having created it with nix-build -K

  2. gilligan commented on Mar 6, 2020

    @gilligan
    Contributor

    I took a brief look at this: So there is void DerivationGoal::deleteTmpDir(bool force) in src/libstore/build.cc which is called by src/libstore/build.cc but the store has no clue about the actual user, which is in fact a good thing.

    I was chatting with @grahamc about this and he pointed out that one nice way to go about this would be to tar up the temporary build directory and make it available to the user via the daemon socket. This wouldn't only solve the issue at hand, it would also make -K work when using remote builders.

    But as nice as this sounds I unfortunately lack the insight to implement this. I just wanted to document the thought here though.

  3. stale commented on Feb 16, 2021

    @stale

    I marked this as stale due to inactivity. → More info

  4. dasJ commented on May 9, 2021

    @dasJ
    Member

    If this ever gets implemented (which I doubt by now), we need to be mitigate security vulnerability that Guix had regarding this behaviour: https://guix.gnu.org/en/blog/2021/risk-of-local-privilege-escalation-via-guix-daemon/

  5. stale commented on Nov 16, 2021

    @stale

    I marked this as stale due to inactivity. → More info

  6. added
    UX
    feature
    and removed on Sep 12, 2022
  7. 3 remaining items

  8. nixos-discourse commented on Jan 13, 2023

    @nixos-discourse
  9. removed their assignment
    on Apr 26, 2024
  10. added a commit that references this issue on Jul 25, 2025
  11. tomberek commented on Aug 13, 2026

    @tomberek
    Contributor

    Closing as stale. Re-open if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    UXfeaturesecurity

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions