Skip to content

Commit

Permalink
Add user account in generic example.
Browse files Browse the repository at this point in the history
* examples/generic.scm (%bobs-ssh-key): New variable.
(users): Add "bob".
(services)[openssh-service-type]: Disallow password logins; authorize
bobs key.
  • Loading branch information
mbakke committed May 30, 2019
1 parent 04de8c4 commit 4a77a02
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions examples/generic.scm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Remember to `guix pull` first to fetch the latest package definitions.
Have fun!\n"))

(define %bobs-ssh-key
"ssh-ed25519 AAAA.....")

(operating-system
(host-name "gnu")
(timezone "Etc/UTC")
Expand All @@ -31,7 +34,12 @@ Have fun!\n"))
;; This is where user accounts are specified. The "root"
;; account is implicit, and is initially created with the
;; empty password.
(users %base-user-accounts)
(users (cons (user-account
(name "bob")
(comment "This is Bob.")
(group "users")
(home-directory "/home/bob"))
%base-user-accounts))

;; Globally-installed packages.
(packages (cons* nvi parted nss-certs
Expand All @@ -47,9 +55,9 @@ Have fun!\n"))
(service dhcp-client-service-type)
(service openssh-service-type
(openssh-configuration
(permit-root-login 'without-password)
(password-authentication? #f)
(authorized-keys
`(("root" ,(local-file "/root/.ssh/authorized_keys"))))))
`(("bob" ,(plain-file "bob.pub" %bobs-ssh-key))))))
(modify-services %base-services
(login-service-type config =>
(login-configuration
Expand Down

0 comments on commit 4a77a02

Please sign in to comment.