diff mbox series

[isar-cip-core,08/11] Remove root password

Message ID 20211115161724.19516-9-alice.ferrazzi@miraclelinux.com (mailing list archive)
State Handled Elsewhere
Headers show
Series cip-core-image-kernelci | expand

Commit Message

Alice Ferrazzi Nov. 15, 2021, 4:17 p.m. UTC
KernelCI require the image to login automatically without
root password for testing.

Signed-off-by: Alice Ferrazzi <alice.ferrazzi@miraclelinux.com>
---
 recipes-core/kernelci-customizations/files/postinst | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Jan Kiszka Nov. 15, 2021, 6:44 p.m. UTC | #1
On 15.11.21 17:17, Alice Ferrazzi wrote:
> KernelCI require the image to login automatically without
> root password for testing.
> 
> Signed-off-by: Alice Ferrazzi <alice.ferrazzi@miraclelinux.com>
> ---
>  recipes-core/kernelci-customizations/files/postinst | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/recipes-core/kernelci-customizations/files/postinst b/recipes-core/kernelci-customizations/files/postinst
> index 33faaeb..68ef9d3 100644
> --- a/recipes-core/kernelci-customizations/files/postinst
> +++ b/recipes-core/kernelci-customizations/files/postinst
> @@ -14,8 +14,16 @@
>  
>  echo "CIP Core Demo & Test Image" > /etc/issue
>  
> +# permit root login without password
>  echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
>  echo "PermitEmptyPasswords yes" >> /etc/ssh/sshd_config
> +passwd root -d

This should also be achievable via

USER_root[flags] = "allow-empty-password"

Could be set in the kernel-ci image recipe. Maybe nicer than the back
and forth.

> +
> +# serial getty service for autologin
> +mkdir -p /etc/systemd/system/serial-getty@.service.d/
> +echo "[Service]" > /etc/systemd/system/serial-getty@.service.d/override.conf
> +echo "ExecStart=" >> /etc/systemd/system/serial-getty@.service.d/override.conf
> +echo "ExecStart=-/sbin/agetty --autologin root --keep-baud 115200,38400,9600 %I $TERM" >> /etc/systemd/system/serial-getty@.service.d/override.conf
>  

Actually topic-wise beyond what $subject suggests.

Jan

>  HOSTNAME=demo
>  echo "$HOSTNAME" > /etc/hostname
>
diff mbox series

Patch

diff --git a/recipes-core/kernelci-customizations/files/postinst b/recipes-core/kernelci-customizations/files/postinst
index 33faaeb..68ef9d3 100644
--- a/recipes-core/kernelci-customizations/files/postinst
+++ b/recipes-core/kernelci-customizations/files/postinst
@@ -14,8 +14,16 @@ 
 
 echo "CIP Core Demo & Test Image" > /etc/issue
 
+# permit root login without password
 echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
 echo "PermitEmptyPasswords yes" >> /etc/ssh/sshd_config
+passwd root -d
+
+# serial getty service for autologin
+mkdir -p /etc/systemd/system/serial-getty@.service.d/
+echo "[Service]" > /etc/systemd/system/serial-getty@.service.d/override.conf
+echo "ExecStart=" >> /etc/systemd/system/serial-getty@.service.d/override.conf
+echo "ExecStart=-/sbin/agetty --autologin root --keep-baud 115200,38400,9600 %I $TERM" >> /etc/systemd/system/serial-getty@.service.d/override.conf
 
 HOSTNAME=demo
 echo "$HOSTNAME" > /etc/hostname