[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can't setuid-program to a custom user

From: Edouard Klein
Subject: Can't setuid-program to a custom user
Date: Tue, 11 Apr 2023 16:47:14 +0200
User-agent: mu4e 1.8.13; emacs 28.2

Dear Guix,

I am trying to install a program that requires its own user, and to
create a suid binary that will launch as this user, no matter who
launches it.

See lines 119 on of this file:

The creation of the account is successful, e.g. when I run a container
like so:
$(guix system container -e "(begin (use-modules (beaver system) (beaver
packages plan9)) (sucf minimal-container))")

I can check /etc/passwd and the user "suc" is in there.
I can launch guile, and type  (getpw "suc") and get in response:
"$1 = #("suc" "x" 1000 30001 "" "/home/suc"

I can check that the directory /var/lib/suc exists and is owned by the
ls -l /var/lib/
total 4
-rw------- 1 root root 512 Apr 11 14:46 random-seed
drwxr-xr-x 2 suc  suc   40 Apr 11 14:46 suc/

However, when I try to setuid the suc binary to user suc:
#+begin_src scheme
      (cons (setuid-program (program (file-append suc "/bin/suc"))
                            (user "suc"))

Then when I launch my container I get:
"ERROR: In procedure getpw:
In procedure getpw: entry not found"

Which is very astonishing given that the user exists !

Does the setuid binaries service try to do its stuff before the accounts
are created ?

Does anybody have the slightest idea of why the user is not found ?

BTW, it works if I setuid to root by removing the `(user "suc")`.

Thanks in advance,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]