[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing user-account's shell
From: |
Ludovic Courtès |
Subject: |
Re: Changing user-account's shell |
Date: |
Fri, 19 Apr 2019 14:04:56 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
Hi Tanguy,
Tanguy Le Carrour <address@hidden> skribis:
> Le 04/18, Ludovic Courtès a écrit :
>> Tanguy Le Carrour <address@hidden> skribis:
>> > I'm trying to set my user's shell through the Guix configuration system,
>> > but without success.
>> > […]
>> > (users (cons (user-account
>> > ;; ...
>> > (shell (file-append fish "/bin/fish")))
>> > %base-user-accounts))
>> > […]
>> Could you tell us what command you run and what error message you got?
>> At first sight this looks good to me.
>
> I run `sudo -E guix system reconfigure my_config.scm` and I don't get
> any error message.
>
> The "funny" thing is, if I add a second user to the system, setting
> Fish as its default shell, it's added with Fish as its default shell!
>
> If I remove `(shell (file-append fish "/bin/fish"))` from the newly
> created account and re-run `guix system reconfigure`, the shell is still
> Fish.
>
> If I add `(shell (file-append bash "/bin/bash"))` to the newly
> created account and re-run `guix system reconfigure`, the shell is still
> Fish.
>
> Bug or feature?!
I say “feature”, but we can discuss it. :-)
The (gnu build accounts) module, which populates /etc/passwd, considers
the user shell to be “state”—i.e., something the user can change with
‘chsh’ and which is preserved, pretty much like passwords changed with
‘passwd’. This happens here:
https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/build/accounts.scm#n486
Thus, when you reconfigure, if the user already exists, its current
shell is preserved, regardless of what you put in the configuration.
I think this is what makes the most sense on a multi-user system: users
shouldn’t have to ask the admins to change their shell.
On a single-user system, it’s a bit different, but you can do both: use
‘chsh’, and adjust your OS config so that it’s correct from the start
when you reinstall.
WDYT?
Thanks,
Ludo’.