diff options
author | наб <nabijaczleweli@nabijaczleweli.xyz> | 2022-03-24 17:15:39 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2022-03-28 14:24:46 +0200 |
commit | 53350c7bbade8c5f357aa3d1029ef9b2208ea675 (patch) | |
tree | 4ace935223a8f92512765e67acf201068fc27f7b /src/nspawn | |
parent | 505df87ea85d62071f6daefa14c52107a085246b (diff) | |
download | systemd-53350c7bbade8c5f357aa3d1029ef9b2208ea675.tar.gz |
Use new default-user-shell option instead of hard-coding bash in nspawn and user-record
Defaults to /bin/bash, no changes in the default configuration
The fallback shell for non-root users is as-specified,
and the interactive shell for nspawn sessions is started as
exec(default-user-shell, "-" + basename(default-user-shell), ...)
before falling through to bash and sh
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index e4c46866a0..aa7367c5c9 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -3550,10 +3550,13 @@ static int inner_child( /* If we cannot change the directory, we'll end up in /, that is expected. */ (void) chdir(home ?: "/root"); - execle("/bin/bash", "-bash", NULL, env_use); - execle("/bin/sh", "-sh", NULL, env_use); + execle(DEFAULT_USER_SHELL, "-" DEFAULT_USER_SHELL_NAME, NULL, env_use); + if (!streq(DEFAULT_USER_SHELL, "/bin/bash")) + execle("/bin/bash", "-bash", NULL, env_use); + if (!streq(DEFAULT_USER_SHELL, "/bin/sh")) + execle("/bin/sh", "-sh", NULL, env_use); - exec_target = "/bin/bash, /bin/sh"; + exec_target = DEFAULT_USER_SHELL ", /bin/bash, /bin/sh"; } return log_error_errno(errno, "execv(%s) failed: %m", exec_target); |