summaryrefslogtreecommitdiff
path: root/src/sysusers
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-08-19 16:43:45 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-08-24 10:02:46 +0200
commit8a7adccbdb23ae6fee82840ef41d17d5e568a8f2 (patch)
tree43c2e7748cf432e98c640b2984385a70960db36e /src/sysusers
parent5f465fda4ec9f1e70a1bb993944ea92b2469b0db (diff)
downloadsystemd-8a7adccbdb23ae6fee82840ef41d17d5e568a8f2.tar.gz
various: try to use DEFAULT_USER_SHELL for root too
/bin/sh as a shell is punishing. There is no good reason to make the occasional root login unpleasant. Since /bin/sh is usually /bin/bash in compat mode, i.e. if one is available, the other will be too, /bin/bash is almost as good as a default. But to avoid a regression in the situation where /bin/bash (or DEFAULT_USER_SHELL) is not installed, we check with access() and fall back to /bin/sh. This should make this change in behaviour less risky. (FWIW, e.g. Fedora/RHEL use /bin/bash as default for root.) This is a follow-up of sorts for 53350c7bbade8c5f357aa3d1029ef9b2208ea675, which added the default-user-shell option, but most likely with the idea of using /bin/bash less ;) Fixes #24369.
Diffstat (limited to 'src/sysusers')
-rw-r--r--src/sysusers/sysusers.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index 5eb67ea084..393d2cc0fc 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -398,7 +398,7 @@ static const char* pick_shell(const Item *i) {
if (i->shell)
return i->shell;
if (i->uid_set && i->uid == 0)
- return "/bin/sh";
+ return default_root_shell(arg_root);
return NOLOGIN;
}