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
This commit is contained in:
наб
2022-03-28 14:24:46 +02:00
committed by Lennart Poettering
parent 505df87ea8
commit 53350c7bba
4 changed files with 13 additions and 4 deletions
+6 -3
View File
@@ -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);