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:
+6
-3
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user