From 29725dfdd38e1c76a5d3f276e58972e86ecfdba9 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Thu, 11 May 2023 11:52:36 -0300 Subject: [PATCH] 20482: Improves file/dir creation on user_data script. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- tools/salt-install/terraform/aws/services/user_data.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tools/salt-install/terraform/aws/services/user_data.sh b/tools/salt-install/terraform/aws/services/user_data.sh index 68af17ee2f..ada3e84ad9 100644 --- a/tools/salt-install/terraform/aws/services/user_data.sh +++ b/tools/salt-install/terraform/aws/services/user_data.sh @@ -20,10 +20,6 @@ apt-get -o Acquire::ForceIPv4=true install -y git curl SSH_DIR="/home/${deploy_user}/.ssh" if [ ! -d "$${SSH_DIR}" ]; then - mkdir $${SSH_DIR} - chown ${deploy_user}.${deploy_user} $${SSH_DIR} - chmod 700 $${SSH_DIR} + install -d -o ${deploy_user} -g ${deploy_user} -m 700 $${SSH_DIR} fi - -echo "${ssh_pubkey}" > $${SSH_DIR}/authorized_keys -chmod 600 $${SSH_DIR}/authorized_keys +echo "${ssh_pubkey}" | install -o ${deploy_user} -g ${deploy_user} -m 600 /dev/stdin $${SSH_DIR}/authorized_keys -- 2.30.2