canonical / canonical/cloud-init

Overriding default user to root doesn't work if ssh_pwauth is set to true

Open
#3,400 1 comment 0 reactions 0 assignees View on GitHub
bug launchpad
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
2d 23h
Merged PRs (30d)
18

Description

This bug was originally filed in Launchpad as [LP: #1834676](https://bugs.launchpad.net/cloud-init/+bug/1834676)

Launchpad details

affected_projects = []

assignee = None
assignee_name = None
date_closed = None
date_created = 2019-06-28T17:51:10.847370+00:00
date_fix_committed = None
date_fix_released = None
id = 1834676
importance = low
is_complete = False
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1834676
milestone = None
owner = nik736
owner_name = Niklas Karoly
private = False
status = triaged
submitter = nik736
submitter_name = Niklas Karoly
tags = []
duplicates = []

_Launchpad user **Niklas Karoly(nik736)** wrote on 2019-06-28T17:51:10.847370+00:00_

We were trying to change the default user from ubuntu to root and at the same time allowing password authentication, which did not work. By adding the "user: root" declaration the user is changed but "ssh_pwauth: true" seems to be only anticipating that the user is not changed to root since:

ssh_pwauth only sets PasswordAuthentication to yes in the sshd_config but not PermitRootLogin.

I am not sure if this is done on purpose or if this is an actual bug.

Example Config:
#cloud-config
user: root
chpasswd: {expire: false}
password: metoo
disable_root: false
ssh_pwauth: true

If someone is stumbling over this via Google, here is a config with a workaround:
# override default_user from ubuntu -> root and allow ssh password logins as root

#cloud-config
user: root
chpasswd: {expire: false}
password: metoo
disable_root: false
ssh_pwauth: true
runcmd:
- echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
- systemctl restart ssh

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.