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

fix: Prevents creating an unexpected user #12

Merged
merged 2 commits into from
May 2, 2024

Conversation

CarlosNihelton
Copy link
Collaborator

@CarlosNihelton CarlosNihelton commented May 2, 2024

/etc/cloud/cloud.cfg sets the default user "ubuntu" for any instance of the Ubuntu distro. Changing that is outside of our scope, as it would affect other platforms.
Instead we override that key with nothing to prevent creating any default user at all. User creation must be explicitely specified by user-data.

Starting an instance without this change (you'll see the "ubuntu" account UID 1000):
image

Starting an instance with this change already seeded (o UID 1000 in /etc/passwd, /home is empty):
Captura de tela 2024-05-02 105742

Fixes: ubuntu/WSL#468
Closes: UDENG-2748

`/etc/cloud/cloud.cfg` sets the default user "ubuntu" for any instance
of the Ubuntu distro. Changing that is outside of our scope, as it would
affect other platforms.
Instead we override that key with nothing to prevent creating any user
at all unless explicitely specified by user-data.

Fixes: ubuntu/WSL#468
@CarlosNihelton CarlosNihelton changed the title Prevents creating an unexpected user fix: Prevents creating an unexpected user May 2, 2024
@CarlosNihelton CarlosNihelton requested a review from didrocks May 2, 2024 14:07
Copy link
Member

@didrocks didrocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question/suggestion!

The redundant "distro" subkey is necessary in order to match exactly what is in
`/etc/cloud/cloud.cfg`, omitting it would result in the default user still being created
as this would be a "generic" `system_info` while the one in `/etc/cloud/cloud.cfg` would be
the Ubuntu specific.
Copy link
Member

@didrocks didrocks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent! We need to prepare a SRU then now!

@CarlosNihelton CarlosNihelton merged commit a249d3f into main May 2, 2024
@CarlosNihelton CarlosNihelton deleted the fix-cloudinit-default-user branch May 2, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected default ubuntu user created on launch
2 participants