From 92417600a1f26510d50310afef19b75c541d05df Mon Sep 17 00:00:00 2001 From: Roy van den Broek Date: Wed, 29 Nov 2006 21:58:09 +0000 Subject: [PATCH] * Example script to set permissions for setuid operation. --- fix_setuid | 9 +++++++++ src/libutil/util.cc | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100755 fix_setuid diff --git a/fix_setuid b/fix_setuid new file mode 100755 index 000000000..1a6dc58dc --- /dev/null +++ b/fix_setuid @@ -0,0 +1,9 @@ +#! /bin/sh +if test -z "$prefix"; then prefix=/nix; fi +chown -Rf nix.nix $prefix/bin $prefix/etc $prefix/include $prefix/lib \ + $prefix/libexec $prefix/man $prefix/share $prefix/var +chown nix.nix $prefix/store +chmod 6755 $prefix/bin/nix-env $prefix/bin/nix-instantiate $prefix/bin/nix-store +chmod 775 $prefix/var/nix/manifests +chmod 775 $prefix/var/nix/gcroots/tmp +chmod 775 $prefix/var/nix/gcroots/channels diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 8bd15a9ae..1634b6660 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -943,7 +943,7 @@ SwitchToOriginalUser::~SwitchToOriginalUser() void switchToNixUser() { fprintf(stderr, "real = %d/%d, effective = %d/%d\n", - getuid(), geteuid(), getgid(), getegid()); + getuid(), getgid(), geteuid(), getegid()); /* Note: we require setresuid for now since I don't want to think to deeply about whether this works on systems that don't have