mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 07:55:21 +01:00
parent
3733b0e4b3
commit
47d331b664
1 changed files with 10 additions and 3 deletions
|
@ -603,16 +603,23 @@ Popup {
|
||||||
addCloudInit("ssh_pwauth: true")
|
addCloudInit("ssh_pwauth: true")
|
||||||
}
|
}
|
||||||
if (radioPubKeyAuthentication.checked) {
|
if (radioPubKeyAuthentication.checked) {
|
||||||
var pubkey = fieldPublicKey.text.replace(/\n/g, "")
|
var pubkey = fieldPublicKey.text
|
||||||
|
var pubkeyArr = pubkey.split("\n")
|
||||||
|
|
||||||
if (pubkey.length) {
|
if (pubkey.length) {
|
||||||
addFirstRun("install -o \"$FIRSTUSER\" -m 700 -d \"$FIRSTUSERHOME/.ssh\"")
|
addFirstRun("install -o \"$FIRSTUSER\" -m 700 -d \"$FIRSTUSERHOME/.ssh\"")
|
||||||
addFirstRun("install -o \"$FIRSTUSER\" -m 600 <(echo \""+pubkey+"\") \"$FIRSTUSERHOME/.ssh/authorized_keys\"")
|
addFirstRun("install -o \"$FIRSTUSER\" -m 600 <(printf \""+pubkey.replace(/\n/g, "\\n")+"\") \"$FIRSTUSERHOME/.ssh/authorized_keys\"")
|
||||||
}
|
}
|
||||||
addFirstRun("echo 'PasswordAuthentication no' >>/etc/ssh/sshd_config")
|
addFirstRun("echo 'PasswordAuthentication no' >>/etc/ssh/sshd_config")
|
||||||
|
|
||||||
addCloudInit(" lock_passwd: true")
|
addCloudInit(" lock_passwd: true")
|
||||||
addCloudInit(" ssh_authorized_keys:")
|
addCloudInit(" ssh_authorized_keys:")
|
||||||
addCloudInit(" - "+pubkey)
|
for (var i=0; i<pubkeyArr.length; i++) {
|
||||||
|
var pk = pubkeyArr[i].trim();
|
||||||
|
if (pk) {
|
||||||
|
addCloudInit(" - "+pk)
|
||||||
|
}
|
||||||
|
}
|
||||||
addCloudInit(" sudo: ALL=(ALL) NOPASSWD:ALL")
|
addCloudInit(" sudo: ALL=(ALL) NOPASSWD:ALL")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue