[systemd-devel] Proposal: extend support for user session unit features

Kok, Auke-jan H auke-jan.h.kok at intel.com
Tue Jul 10 09:20:14 PDT 2012


On Tue, Jul 10, 2012 at 2:06 PM, Lennart Poettering
<lennart at poettering.net> wrote:
> On Tue, 10.07.12 15:32, Ran Benita (ran234 at gmail.com) wrote:
>
>>
>> On Tue, Jul 10, 2012 at 05:00:43AM +0000, Kok, Auke-jan H wrote:
>> > So in short, I'd like to do both:
>> >
>> > - have systemd chdir to $HOME if uid != 1
>> >
>> > - extend the printf specifier list for user sessions with a specifer
>> > that can be used in various fields to refer to at minimum $HOME ("%h"
>> > ?) and possibly $UID ("%u") and $SHELL ("%s"), since these fields are
>> > part of the struct *passwd, and might be useful at some point.
>> >
>> > Comments? I'll post a patch gladly to implement this.
>> >
>>
>> I think that's useful as well, and used it for a while. Also see
>> http://lists.freedesktop.org/archives/systemd-devel/2011-December/004076.html
>
> Hmm, this patch looks pretty good. How did I miss that? Shame on me.

and on me! :^)

> I'd merge this patch, with two changes:
>
> Could you please split up the function into two, one for each of %u and
> %h?
>
> Also, I think we should honour $HOME if it is set and fall back to
> getpwuid(getuid())->pw_home if it isn't. This might be a good candidate
> for a new call get_home() or so, in util.c. Hmm, and I wonder if
> getlogname_malloc() is actually the best choice for %u. It probably
> should honour $USER too, and otherwise resolve getpwuid(getuid()), but
> not do the tty stuff that getlogname_malloc() does. (getlogname_mallc()
> has a different use: it should return the user who actually really
> originally logged in. But for the --user purpose we'd need the user of
> that runs systemd, hence this should be a different call).
>
> And I guess Auke's suggested $SHELL specifier would be cool too.

we can do without that for a while longer, but it would be nice to be
fairly complete at this point, which is why I suggested that.

Ran's patch looks exactly like what I need.

Ran, do you want to respin the patch? If not, I'll gladly do that.

Auke


More information about the systemd-devel mailing list