mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
environment: Add --user.
This change allows overriding the home directory of all filesystem mappings to help hide the identity of the calling user in a container. * doc/guix.texi (Invoking guix environment)[--container]: Mention --user. [--user]: Add item. * guix/scripts/environment.scm (show-help): Add --user. (%options): Add --user. (launch-environment/container) Add 'user' parameter. Update doc. Override 'user-mappings' using 'override-user-mappings'. Consider override for chdir. (mock-passwd, user-override-home, overrid-euser-dir): New procedures. (guix-environment): Disallow --user without --container. Provide user to 'launch-environment/container'. * tests/guix-environment.sh: Add user test. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
07ec349229
commit
e37944d827
3 changed files with 138 additions and 29 deletions
|
@ -109,6 +109,17 @@ rm $tmpdir/mounts
|
|||
-- guile -c "$linktest"
|
||||
)
|
||||
|
||||
# Test that user can be mocked.
|
||||
usertest='(exit (and (string=? (getenv "HOME") "/home/foognu")
|
||||
(string=? (passwd:name (getpwuid 0)) "foognu")
|
||||
(file-exists? "/home/foognu/umock")))'
|
||||
touch "$tmpdir/umock"
|
||||
HOME="$tmpdir" guix environment --bootstrap --container --user=foognu \
|
||||
--ad-hoc guile-bootstrap --pure \
|
||||
--share="$tmpdir/umock" \
|
||||
-- guile -c "$usertest"
|
||||
|
||||
|
||||
# Check the exit code.
|
||||
|
||||
abnormal_exit_code="
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue