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

disable_root: true does not disable ssh login as root user #5931

Open
martipoe opened this issue Dec 14, 2024 · 0 comments
Open

disable_root: true does not disable ssh login as root user #5931

martipoe opened this issue Dec 14, 2024 · 0 comments
Labels
bug Something isn't working correctly new An issue that still needs triage

Comments

@martipoe
Copy link

Bug report

I created a packer image for Debian 12 with key-based ssh root access for provisioning tasks during the build process.

When creating an instance from this image with Terraform, I want to disable ssh login for the root user and lock the password.

The documentation states:

disable_root: (boolean) Disable root login. Default: true

Therefore I apply the below user_data config in Terraform.

I can see that cloudinit is run, the file /etc/ssh/sshd_config.d/50-cloud-init.conf is created and disables ssh password auth:

PasswordAuthentication no

But root login using the packer ssh key is still possible. 'PermitRootLogin no' is missing.

Steps to reproduce the problem

#cloud-config
disable_root: true
ssh_pwauth: false

users:
   - name: root
      lock_passwd: true
    - name: ansible
      uid: 1000
      ...

Environment details

  • Cloud-init version: 22.4.2-1+deb12u2
  • Operating System Distribution: Debian 12
  • Cloud provider, platform or installer type: nocloud

cloud-init logs

cloud-init.tar.gz

@martipoe martipoe added bug Something isn't working correctly new An issue that still needs triage labels Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly new An issue that still needs triage
Projects
None yet
Development

No branches or pull requests

1 participant