[systemd-devel] %s specifier

Kok, Auke-jan H auke-jan.h.kok at intel.com
Thu Feb 7 11:15:56 PST 2013


On Thu, Feb 7, 2013 at 7:13 AM, Zbigniew Jędrzejewski-Szmek
<zbyszek at in.waw.pl> wrote:
> On Wed, Feb 06, 2013 at 04:30:40PM -0800, Kok, Auke-jan H wrote:
>> On Wed, Feb 6, 2013 at 4:21 PM, Zbigniew Jędrzejewski-Szmek
>> <zbyszek at in.waw.pl> wrote:
>> > current docs specify that %s means the shell of the user configured
>> > with User= or the user running systemd. However, it actually often
>> > returns /bin/sh. What is the intended behaviour?
>>
>> it should reflect the passwd entry, which by default is "/bin/sh" if
>> unset. It may also return that if using some other form of credential
>> backend - glibc provides the data.
>
> I think that this make sense. I'll update the documentation and tests to
> reflect this.

Just to clarify, here's what happens:

get_shell() is called, which in turn will:

1) check for getenv("SHELL") if set
2) return ("/bin/sh") for root to prevent nss lookups
3) check getpwuid() and return the passwd SHELL setting

on any failure in this process, "/bin/sh" is used as dummy value.

hth

Auke

>
> Zbyszek


More information about the systemd-devel mailing list