GuixSD: Please add the ability to change shells for root

  • Open
  • quality assurance status badge
Details
5 participants
  • Alex Sassmannshausen
  • BJH2017
  • Leo Famulari
  • Ludovic Courtès
  • Ricardo Wurmus
Owner
unassigned
Submitted by
BJH2017
Severity
normal

Debbugs page

B
B
BJH2017 wrote on 14 Dec 2017 00:38
(address . bug-guix@gnu.org)
CANb+58+BMeVR0Vw5GenuejY5GTcovFsbn-hkw5+LZ5yQ6MpQaQ@mail.gmail.com
Using the configuration file /etc/config.scm it is fairly straight forward
to change shells for a given user account on GuixSD 0.14.0, such as using:

(operating system
(users (cons (user-account
(name "user")
....
(shell "/run/current-system/profile/bin/zsh")))))

, but for root this is impossible. Is it possible this feature could be
added?
Attachment: file
L
L
Ludovic Courtès wrote on 18 Dec 2017 14:18
(name . BJH2017)(address . brentonhorne77@gmail.com)(address . 29706@debbugs.gnu.org)
87o9mv7k8o.fsf@gnu.org
Hi,

BJH2017 <brentonhorne77@gmail.com> skribis:

Toggle quote (12 lines)
> Using the configuration file /etc/config.scm it is fairly straight forward
> to change shells for a given user account on GuixSD 0.14.0, such as using:
>
> (operating system
> (users (cons (user-account
> (name "user")
> ....
> (shell "/run/current-system/profile/bin/zsh")))))
>
> , but for root this is impossible. Is it possible this feature could be
> added?

I just realized it’s actually possible: if you add an account with
UID 0, then that account is the root account.

So you can write:

(operating-system
;; …
(users (cons (user-account
(name "this-can-be-root-or-something-else")
(uid 0)
;; …
(shell (file-append zsh "/bin/zsh")))
…)))

… and you get a root account with the chosen name and shell.

Does it work for you?

I’ve clarified the situation:


Thanks,
Ludo’.
L
L
Ludovic Courtès wrote on 19 Dec 2017 06:53
(name . BJH2017)(address . brentonhorne77@gmail.com)(address . 29706@debbugs.gnu.org)
8737466a6r.fsf@gnu.org
Please always keep the list Cc’d.

BJH2017 <brentonhorne77@gmail.com> skribis:

Toggle quote (14 lines)
> No it doesn't, I have this at the moment:
>
> (name "root")
> (uid 0)
> (group "root")
> (home-directory "/root")
> (shell (file-append zsh "/bin/zsh")))
>
> and I get the error:
>
> guix system: error: failed to load '/etc/config.scm':
> /etc/config.scm:35:9: /etc/config.scm:35:9: Wrong number of arguments to
> #<procedure cons (_ _)>

‘cons’ adds an element to a list, so it takes two arguments:

(cons account list)

as in:

(cons (user-account …) %base-user-accounts)

HTH!

Ludo’.
B
B
BJH2017 wrote on 19 Dec 2017 07:02
(address . bug-guix@gnu.org)
CANb+58KT8HzksVpktAPtzKkv9yKz7mfdmnEpXrGUMzWZ-q7TiQ@mail.gmail.com
(thought I had CC'ed the group with my last comment but unfortunately gmail
doesn't do this by default, sorry)

Ya I do have %base-user-accounts in my config file here is what I had for
user accounts in full:

(users (cons
(user-account
(name "root")
(uid 0)
(group "root")
(supplementary-groups '("home-directory"))
(home-directory "/root")
(shell (file-append zsh "/bin/zsh")))
(user-account
(name "fusion809")
(comment "Brenton Horne")
(group "users")
(supplementary-groups '("wheel" "netdev"
"audio" "video"))
(home-directory "/home/fusion809")
(shell "/run/current-system/profile/bin/zsh"))
%base-user-accounts))

guessing the problem here is that I have two user-account fields?


On 20 December 2017 at 00:53, Ludovic Courtès <ludo@gnu.org> wrote:

Toggle quote (30 lines)
> Please always keep the list Cc’d.
>
> BJH2017 <brentonhorne77@gmail.com> skribis:
>
> > No it doesn't, I have this at the moment:
> >
> > (name "root")
> > (uid 0)
> > (group "root")
> > (home-directory "/root")
> > (shell (file-append zsh "/bin/zsh")))
> >
> > and I get the error:
> >
> > guix system: error: failed to load '/etc/config.scm':
> > /etc/config.scm:35:9: /etc/config.scm:35:9: Wrong number of arguments to
> > #<procedure cons (_ _)>
>
> ‘cons’ adds an element to a list, so it takes two arguments:
>
> (cons account list)
>
> as in:
>
> (cons (user-account …) %base-user-accounts)
>
> HTH!
>
> Ludo’.
>
Attachment: file
R
R
Ricardo Wurmus wrote on 19 Dec 2017 07:26
(name . BJH2017)(address . brentonhorne77@gmail.com)(address . 29706@debbugs.gnu.org)
87vah2kacp.fsf@elephly.net
Hi,

Toggle quote (20 lines)
> (users (cons
> (user-account
> (name "root")
> (uid 0)
> (group "root")
> (supplementary-groups '("home-directory"))
> (home-directory "/root")
> (shell (file-append zsh "/bin/zsh")))
> (user-account
> (name "fusion809")
> (comment "Brenton Horne")
> (group "users")
> (supplementary-groups '("wheel" "netdev"
> "audio" "video"))
> (home-directory "/home/fusion809")
> (shell "/run/current-system/profile/bin/zsh"))
> %base-user-accounts))
>
> guessing the problem here is that I have two user-account fields?

Yes, “cons” takes a single item (its first argument) and prepends it to a
list (its second argument). You can use “cons*” here, which prepends
more than one thing to a list.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
A
A
Alex Sassmannshausen wrote on 19 Dec 2017 07:34
(name . BJH2017)(address . brentonhorne77@gmail.com)(address . 29706@debbugs.gnu.org)
87mv2eg298.fsf@pompo.co
Hi,

BJH2017 writes:

Toggle quote (24 lines)
> (thought I had CC'ed the group with my last comment but unfortunately gmail doesn't do this by default, sorry)
>
> Ya I do have %base-user-accounts in my config file here is what I had for user accounts in full:
>
> (users (cons
> (user-account
> (name "root")
> (uid 0)
> (group "root")
> (supplementary-groups '("home-directory"))
> (home-directory "/root")
> (shell (file-append zsh "/bin/zsh")))
> (user-account
> (name "fusion809")
> (comment "Brenton Horne")
> (group "users")
> (supplementary-groups '("wheel" "netdev"
> "audio" "video"))
> (home-directory "/home/fusion809")
> (shell "/run/current-system/profile/bin/zsh"))
> %base-user-accounts))
>
> guessing the problem here is that I have two user-account fields?

That's correct. Either use:

(cons (user-account ...)
(cons (user-account ...)
%base-user-accounts))

Or

(cons* (user-account ...) (user-account ...) %base-user-accounts)

HTH,

Alex

Toggle quote (31 lines)
> On 20 December 2017 at 00:53, Ludovic Courtès <ludo@gnu.org> wrote:
>
> Please always keep the list Cc’d.
>
> BJH2017 <brentonhorne77@gmail.com> skribis:
>
> > No it doesn't, I have this at the moment:
> >
> > (name "root")
> > (uid 0)
> > (group "root")
> > (home-directory "/root")
> > (shell (file-append zsh "/bin/zsh")))
> >
> > and I get the error:
> >
> > guix system: error: failed to load '/etc/config.scm':
> > /etc/config.scm:35:9: /etc/config.scm:35:9: Wrong number of arguments to
> > #<procedure cons (_ _)>
>
> ‘cons’ adds an element to a list, so it takes two arguments:
>
> (cons account list)
>
> as in:
>
> (cons (user-account …) %base-user-accounts)
>
> HTH!
>
> Ludo’.
L
L
Leo Famulari wrote on 19 Dec 2017 07:39
(name . BJH2017)(address . brentonhorne77@gmail.com)(address . 29706@debbugs.gnu.org)
20171219153913.GA26833@jasmine.lan
On Wed, Dec 20, 2017 at 01:02:02AM +1000, BJH2017 wrote:
Toggle quote (26 lines)
> (thought I had CC'ed the group with my last comment but unfortunately gmail
> doesn't do this by default, sorry)
>
> Ya I do have %base-user-accounts in my config file here is what I had for
> user accounts in full:
>
> (users (cons
> (user-account
> (name "root")
> (uid 0)
> (group "root")
> (supplementary-groups '("home-directory"))
> (home-directory "/root")
> (shell (file-append zsh "/bin/zsh")))
> (user-account
> (name "fusion809")
> (comment "Brenton Horne")
> (group "users")
> (supplementary-groups '("wheel" "netdev"
> "audio" "video"))
> (home-directory "/home/fusion809")
> (shell "/run/current-system/profile/bin/zsh"))
> %base-user-accounts))
>
> guessing the problem here is that I have two user-account fields?

Right, if you are adding more than one element to %base-user-accounts,
you'll need to use cons* instead of cons.

(users (cons* (user-account
(name "root")
...)
(user-account
(name "fusion809")
...)
%base-user-accounts))
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEsFFZSPHn08G5gDigJkb6MLrKfwgFAlo5Mp4ACgkQJkb6MLrK
fwiKehAAkKkfFV89YqNohKEOelVfH5dYxvHRFAyTkBj2lwXPtPWIz6DAicCDvLd2
K5YVF4dneIw1Ghgm0J+kJTjiuR6jVtpDWXhKzxbfX8RxojsKoPZ5fgp4RNKapc+n
O4gavsC6CPxfNHdxoBSaztsEenProjWqjR0OylbcRvC/5A5fFvUeh8Jb4WK16Duu
VHLswSJ42c7IbGxfWIPyAcYzLN+eoTvgd9fV8q3/HX7EGxZ8m7iiN3fdHFZamY35
K5Ho4NbIsZVcQRTZ/tuNFUADRO+LrN4YR7NTsnJrmRacb85Vjqdis4KN4E8KuHYI
1Z+QLTZMLh/Q6qP9djzaJFynA4U3nFDsuap3K1JYzBCiVUPYy1R7e8tUG019Qu7u
lB65sdVVcpO6McvJUA6TIU0JekXc0MI9oPKTEA+vZsFEWZZgfKDC9utt2mS9Aekn
G/rRymuItW3Fp/0FG2xMqbNJS8OUt/mK1pzt5HxiCyKPIPgVmid76zPT6jHgoHcY
wgHuuzHzUOr02MTQNMyo/+EJKr63de5jS9y+ApNXOSjGSTf9g7/ue51GwuQTWPPb
SzHvJ5jLEzOQwW+uEJ63n+wnhwig0AgI1ZdvwFHQEhRkgD//zqNmBp782QSEUPgj
EaEhh9E687IIg9EVpfBK1Nuo0FYczzjqX+otx4nUBLSQhuYRq5Y=
=fH7Y
-----END PGP SIGNATURE-----


L
L
Ludovic Courtès wrote on 19 Dec 2017 09:16
(name . BJH2017)(address . brentonhorne77@gmail.com)(address . 29706@debbugs.gnu.org)
87po7a1vv8.fsf@gnu.org
Hello,

BJH2017 <brentonhorne77@gmail.com> skribis:

Toggle quote (21 lines)
> Ya I do have %base-user-accounts in my config file here is what I had for
> user accounts in full:
>
> (users (cons
> (user-account
> (name "root")
> (uid 0)
> (group "root")
> (supplementary-groups '("home-directory"))
> (home-directory "/root")
> (shell (file-append zsh "/bin/zsh")))
> (user-account
> (name "fusion809")
> (comment "Brenton Horne")
> (group "users")
> (supplementary-groups '("wheel" "netdev"
> "audio" "video"))
> (home-directory "/home/fusion809")
> (shell "/run/current-system/profile/bin/zsh"))
> %base-user-accounts))

Here ‘cons’ is given three arguments. You should use ‘cons*’ instead.
To do that you’ll also need to add this line to the top of your file:

(use-modules (srfi srfi-1)) ;for 'cons*'

HTH,
Ludo’.
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 29706@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 29706
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch