From 2bae922e92194606b386b1ac6fb566aaed2c08f6 Mon Sep 17 00:00:00 2001 From: Olivier Le Thanh Duong Date: Fri, 16 Aug 2024 11:53:07 +0200 Subject: [PATCH] CoCo image: Improve example user creation --- .../setup_debian_rootfs.sh | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/examples/example_confidential_image/setup_debian_rootfs.sh b/examples/example_confidential_image/setup_debian_rootfs.sh index e3d320b1..ff732dfd 100644 --- a/examples/example_confidential_image/setup_debian_rootfs.sh +++ b/examples/example_confidential_image/setup_debian_rootfs.sh @@ -107,8 +107,26 @@ update-initramfs -u ssh-keygen -A ### Example to add a user with sudo right -#useradd -m -s /bin/bash username -#echo 'username:password' | chpasswd -#usermod -aG sudo username - +#USER="username" +#PASSWORD="password" +#SSH_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArQslTrAf9A... user@example.com" + +## Create a new user with a home directory and Bash shell +#useradd -m -s /bin/bash "$USER" +# +## Set the user's password +#echo "$USER:$PASSWORD" | chpasswd +# +## Add the user to the sudo group +#usermod -aG sudo "$USER" +# +## Install ssh key +#USER_HOME="/home/$USER" +#mkdir -p "$USER_HOME/.ssh" +#chmod 700 "$USER_HOME/.ssh" +#echo "$SSH_KEY" >> "$USER_HOME/.ssh/authorized_keys" +#chmod 600 "$USER_HOME/.ssh/authorized_keys" +#chown -R $USER:$USER "$USER_HOME/.ssh" + +### END example umount /tmp \ No newline at end of file