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

Unexpected default ubuntu user created on launch #468

Closed
1 task done
CarlosNihelton opened this issue May 2, 2024 · 1 comment · Fixed by ubuntu/wsl-setup#12
Closed
1 task done

Unexpected default ubuntu user created on launch #468

CarlosNihelton opened this issue May 2, 2024 · 1 comment · Fixed by ubuntu/wsl-setup#12
Labels
bug Something isn't working jira Import to Jira

Comments

@CarlosNihelton
Copy link
Collaborator

cmd /c ver

Microsoft Windows [Version 10.0.26200.5001]

wsl --status

wsl --status
Default Distribution: Ubuntu
Default Version: 2

Did the problem occur during installation?

  • Yes

What happened?

Either registering an instance of Ubuntu-24.04 via the distro launcher or importing the root filesystem I get an unexpected user named "ubuntu" uid 1000. That happens because cloud-init has a configuration entry in /etc/cloud/cloud.cfg to create that user. When cloud-init is disabled via kernel command line the unexpected user is never created.

What was expected?

No other user accounts should be implicitely created.

Steps to reproduce

ubuntu2204.exe install --root
ubuntu2204.exe run grep ubuntu /etc/passwd

The output of that command should be empty, but it shows a line containing the "ubuntu" user account.

Additional information

The (untouched) configuration file /etc/cloud/cloud.cfg contains the following section:

# System and/or distro specific settings
# (not accessible to handlers/transforms)
system_info:
  # This will affect which distro class gets used
  distro: ubuntu
  # Default user name + that default users groups (if added/used)
  default_user:
    name: ubuntu
    lock_passwd: True
    gecos: Ubuntu
    groups: [adm, cdrom, dip, lxd, sudo]
    sudo: ["ALL=(ALL) NOPASSWD:ALL"]
    shell: /bin/bash

There are no overrides for that key in /etc/cloud/cloud.cgf.d/.

CarlosNihelton added a commit to ubuntu/wsl-setup that referenced this issue 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 user
at all unless explicitely specified by user-data.

Fixes: ubuntu/WSL#468
@CarlosNihelton CarlosNihelton added jira Import to Jira bug Something isn't working labels May 2, 2024
@avlec
Copy link

avlec commented May 15, 2024

What version / when is this fix available?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working jira Import to Jira
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants