From e54b913fa4258bdd850cb674113432f6ec790cfe Mon Sep 17 00:00:00 2001 From: Jake Buchholz Date: Fri, 8 Jan 2021 19:36:14 -0800 Subject: [PATCH] only lock root, not EC2_USER --- tiny-ec2-bootstrap | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tiny-ec2-bootstrap b/tiny-ec2-bootstrap index 3108283..0de02c7 100644 --- a/tiny-ec2-bootstrap +++ b/tiny-ec2-bootstrap @@ -85,8 +85,12 @@ _resize_root_partition() { resize2fs "$mountpoint" } +_lock_root_user() { + passwd -l root +} + _disable_password() { - passwd -l "$1" + echo "$1:*" | chpasswd -e } start() { @@ -95,7 +99,7 @@ start() { [ -d "/var/lib/cloud" ] || mkdir -p /var/lib/cloud - ebegin "Disabling root password"; _disable_password root; eend $? + ebegin "Locking root account"; _lock_root_account; eend $? ebegin "Disabling $EC2_USER password"; _disable_password "$EC2_USER"; eend $? ebegin "Expanding root partition"; _resize_root_partition; eend $? ebegin "Setting ec2 hostname"; _update_hostname; eend $?