unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Tanguy Le Carrour <tanguy@bioneland.org>
Cc: help-guix@gnu.org
Subject: Re: Changing user-account's shell
Date: Fri, 19 Apr 2019 14:04:56 +0200	[thread overview]
Message-ID: <87r29yciaf.fsf@gnu.org> (raw)
In-Reply-To: <20190418205131.mthcnvo3dodf3pvx@melmoth> (Tanguy Le Carrour's message of "Thu, 18 Apr 2019 22:51:31 +0200")

Hi Tanguy,

Tanguy Le Carrour <tanguy@bioneland.org> skribis:

> Le 04/18, Ludovic Courtès a écrit :
>> Tanguy Le Carrour <tanguy@bioneland.org> 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’.

  reply	other threads:[~2019-04-19 12:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-17 19:59 Changing user-account's shell Tanguy Le Carrour
2019-04-18 14:45 ` Ludovic Courtès
2019-04-18 20:51   ` Tanguy Le Carrour
2019-04-19 12:04     ` Ludovic Courtès [this message]
2019-04-19 21:30       ` Tanguy Le Carrour
     [not found] ` <87d0lkz5jw.fsf@ambrevar.xyz>
2019-04-18 20:22   ` Tanguy Le Carrour
2019-04-19  6:53     ` Pierre Neidhardt
2019-04-19 21:24       ` Tanguy Le Carrour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r29yciaf.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=help-guix@gnu.org \
    --cc=tanguy@bioneland.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).