cloud-init: reorder ssh/user creation

This commit is contained in:
Floris Bos 2022-01-21 17:25:32 +01:00
parent 566450c728
commit 243da48257

View file

@ -624,10 +624,6 @@ Popup {
addCloudInit(" lock_passwd: false")
addCloudInit(" passwd: "+cryptedPassword)
addCloudInit("")
}
if (chkSSH.checked && radioPasswordAuthentication.checked) {
addCloudInit("ssh_pwauth: true")
}
if (chkSSH.checked && radioPubKeyAuthentication.checked) {
@ -640,7 +636,9 @@ Popup {
}
addFirstRun("echo 'PasswordAuthentication no' >>/etc/ssh/sshd_config")
if (!chkSetUser.checked) {
addCloudInit(" lock_passwd: true")
}
addCloudInit(" ssh_authorized_keys:")
for (var i=0; i<pubkeyArr.length; i++) {
var pk = pubkeyArr[i].trim();
@ -650,6 +648,11 @@ Popup {
}
addCloudInit(" sudo: ALL=(ALL) NOPASSWD:ALL")
}
addCloudInit("")
if (chkSSH.checked && radioPasswordAuthentication.checked) {
addCloudInit("ssh_pwauth: true")
}
/* Rename first ("pi") user if a different desired username was specified */
addFirstRun("if [ \"$FIRSTUSER\" != \""+fieldUserName.text+"\" ]; then")