Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloud-init: homedir and shell are required when creating new users #13

Closed
mudler opened this issue Feb 11, 2022 · 3 comments · Fixed by mudler/yip#37 or rancher/elemental-toolkit#1196
Assignees

Comments

@mudler
Copy link
Contributor

mudler commented Feb 11, 2022

Booting with the following cloud-init file fails adding the vagrant user:

#cloud-config

# Add additional users or set the password/ssh keys for root
users:
- name: "root"
  passwd: "ros"
  ssh_authorized_keys:
  - https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub
- name: "vagrant"
  passwd: "vagrant"
  ssh_authorized_keys:
  - https://raw.githubusercontent.com/hashicorp/vagrant/main/keys/vagrant.pub

cos-setup-network:
Screenshot from 2022-02-11 10-04-16

@mudler mudler added the kind/bug Something isn't working label Feb 11, 2022
@mudler
Copy link
Contributor Author

mudler commented Feb 11, 2022

Ok, this seems to be a simple cloud-init nuance, it looks like the homedir and shell field don't have defaults, so they are mandatory when creating new users.

This indeed works:

#cloud-config

# Add additional users or set the password/ssh keys for root
users:
- name: "root"
  passwd: "ros"
- name: "vagrant"
  passwd: "vagrant"
  shell: "/bin/bash"
  homedir: "/run/vagrant"

mudler added a commit that referenced this issue Feb 11, 2022
homedir/shell don't have defaults. See:
#13
@mudler
Copy link
Contributor Author

mudler commented Feb 11, 2022

I've been testing in openstack with the https://github.com/rancher-sandbox/os2/tree/fixups/cloud-init branch

@mudler mudler changed the title Failure creating new users cloud-init: homedir and shell are required when creating new users Feb 11, 2022
mudler added a commit that referenced this issue Feb 11, 2022
homedir/shell don't have defaults. See:
#13

Signed-off-by: Ettore Di Giacinto <edigiacinto@suse.com>
mudler added a commit that referenced this issue Feb 14, 2022
homedir/shell don't have defaults. See:
#13

Signed-off-by: Ettore Di Giacinto <edigiacinto@suse.com>
@mudler mudler added the area/UX label Mar 15, 2022
@davidcassany davidcassany self-assigned this Mar 21, 2022
davidcassany added a commit to mudler/yip that referenced this issue Mar 21, 2022
This commit reads "/etc/default/useradd" file to get default
home and shell for new users. In case the defaults file is not there
simply use "/home" and "/bin/sh" as defaults.

Fixes rancher/elemental#13

Signed-off-by: David Cassany <dcassany@suse.com>
mudler pushed a commit to mudler/yip that referenced this issue Mar 21, 2022
This commit reads "/etc/default/useradd" file to get default
home and shell for new users. In case the defaults file is not there
simply use "/home" and "/bin/sh" as defaults.

Fixes rancher/elemental#13

Signed-off-by: David Cassany <dcassany@suse.com>
@mudler
Copy link
Contributor Author

mudler commented Mar 22, 2022

It actually needs a bump in elemental-cli 🥲

@mudler mudler reopened this Mar 22, 2022
davidcassany added a commit to rancher/elemental-cli that referenced this issue Mar 22, 2022
This commit is to bump yip library to include the latest user
creation patches (mudler/yip#37).

Fixes rancher/elemental#13

Signed-off-by: David Cassany <dcassany@suse.com>
davidcassany added a commit to rancher/elemental-cli that referenced this issue Mar 22, 2022
This commit is to bump yip library to include the latest user
creation patches (mudler/yip#37).

Related to rancher/elemental#13

Signed-off-by: David Cassany <dcassany@suse.com>
davidcassany added a commit to rancher/elemental-toolkit that referenced this issue Mar 22, 2022
This commit is to include the latest elemental in os2.

Fixes rancher/elemental#13

Signed-off-by: David Cassany <dcassany@suse.com>
davidcassany added a commit to rancher/elemental-toolkit that referenced this issue Mar 22, 2022
This commit is to include the latest elemental in os2.

Fixes rancher/elemental#13

Signed-off-by: David Cassany <dcassany@suse.com>
mudler pushed a commit that referenced this issue Jun 3, 2022
…ilities

Follow similar code practices as in utilities package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants